[英]Vue warn Cannot read property of null
I'm new to vue and I've been trying to solve this warn in my console about Cannot read property of null. 我是vue的新手,我一直在尝试解决控制台中有关无法读取null属性的警告。 I tried to put a default value in my props but no luck.
我试图在道具中设置默认值,但是没有运气。 I can get the value inside
:condition
but inside the console it shows warning can't read property of null 我可以在
:condition
内部获取值,但在控制台内部显示警告无法读取null属性
props: ['user']
Inside heading component: 内部标题组件:
<header-tooltip :total="total" title="High Paying Cash Surveys" :user="user" :condition="user.hpcs" :currency="currency" placeholder="0"></header-tooltip>
Warn: 警告:
[Vue warn]: Error when evaluating expression "user.hpcs": TypeError: Cannot read property 'hpcs' of null (found in component: <heading>)
Finally got an answer from reading the vue.js silent api docs. 通过阅读vue.js静默 api文档,终于得到了答案。 These guy will erase all the vue logs and warnings if we wanted our app in production state.
如果我们希望我们的应用程序处于生产状态,这些人将清除所有的vue日志和警告。 Other method is if we install vue via
npm
then we should include the minified vue script inside our blade. 另一种方法是,如果我们通过
npm
安装vue,则应在刀片中包含缩小的vue脚本。 Using minified will prevent warnings and logs inside your vue and it's good for production purposes. 使用minified可以防止警告和vue内的日志,这对生产很有帮助。
Locate your vue js and enter the code below: 找到您的vue js,然后输入以下代码:
Vue.config.silent = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.