Vue警告无法读取null的属性

时间:2016-10-04 04:16:08

标签: laravel vue.js

我是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>)

1 个答案:

答案 0 :(得分:0)

最后通过阅读vue.js silent api文档得到了答案。 如果我们希望我们的应用程序处于生产状态,这些人将删除所有vue日志和警告。其他方法是如果我们通过npm安装vue,那么我们应该在我们的刀片中包含缩小的vue脚本。使用minified将防止警告和日志记录在您的vue中,并且它有利于生产目的。

找到您的vue js并输入以下代码:

Vue.config.silent = true
相关问题