[英][Vue warn]: Error in render: “TypeError: Cannot read property 'id' of undefined”
[英]Vue warn Cannot read property of null
我是vue的新手,我一直在尝试解决控制台中有关无法读取null属性的警告。 我试图在道具中设置默认值,但是没有运气。 我可以在:condition
内部获取值,但在控制台内部显示警告无法读取null属性
props: ['user']
内部标题组件:
<header-tooltip :total="total" title="High Paying Cash Surveys" :user="user" :condition="user.hpcs" :currency="currency" placeholder="0"></header-tooltip>
警告:
[Vue warn]: Error when evaluating expression "user.hpcs": TypeError: Cannot read property 'hpcs' of null (found in component: <heading>)
通过阅读vue.js静默 api文档,终于得到了答案。 如果我们希望我们的应用程序处于生产状态,这些人将清除所有的vue日志和警告。 另一种方法是,如果我们通过npm
安装vue,则应在刀片中包含缩小的vue脚本。 使用minified可以防止警告和vue内的日志,这对生产很有帮助。
找到您的vue js,然后输入以下代码:
Vue.config.silent = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.