vue.js - VueJS 在 DOM 中渲染一些 v-binds(函数和数据)
问题描述
我在我的路由器视图上使用 v-bind 来获取要在组件中使用的一些数据对象和函数,有些工作完全符合预期,但有些工作出于某种原因被渲染到 DOM 中,我找不到它们的原因被渲染,而其他则没有。
这正常吗?或者我该如何解决这个问题?
Fe userString 和函数 userFunction 被渲染到路由器视图 div 中,但 otherUserString 不是。
<router-view
v-bind:userString="userString"
v-bind:userObject="userObject"
v-bind:userFunction="userFunction"
v-bind:otherUserString="otherUserString"
v-bind:otherUserObject="otherUserObject"
v-bind:otherUserFunction="otherUserFunction"
/>
我的结果如下(为了便于阅读而分解):
<div
data-v-571e686
userstring="XXXXXX"
useraction="function () { [native code] }"
userobject="[object Object]" >
我的预期是:
<div data-v-571e686>
解决方案
Vue Router 没有 userEncrypted 和 encryptUser 属性。https://router.vuejs.org/api/#exact-active-class
如果这是您的自定义组件,请确保已定义这些道具。
推荐阅读
- html - Css 位置 div 给出了意想不到的结果
- python - json解码错误期望值
- database - 在 mongoDB 中 find 命令返回游标是什么意思?
- javascript - 如何在需要 API 密钥的 Google Apps 脚本中使用外部 API?
- mongodb - 升级到 rails 5,mongodb 作为数据库
- awk - grep 命令以“HR:MIN MST”格式从日志文件中提取时间
- android - 在 KeyboardAvoidingView 内时平面列表不可滚动
- ios - 附加选项卡,编辑表格时
- c - “scanf”功能使我的整个程序崩溃?
- aws-lambda - 由 Alexa for Business 组织并由 DSN 过滤的多个 Echo?