简体   繁体   English

Vue警告无法读取null属性

[英]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.

相关问题 [Vue警告]:渲染错误:“ TypeError:无法读取未定义的属性&#39;id&#39;” - [Vue warn]: Error in render: “TypeError: Cannot read property 'id' of undefined” vue3无法读取null的属性'insertBefore' - vue3 Cannot read property 'insertBefore' of null Vue 警告:创建的钩子出错:“TypeError:无法读取未定义的属性‘get’” - Vue warn: Error in created hook: "TypeError: Cannot read property 'get' of undefined" [Vue警告]:v-on处理程序中的错误:“ TypeError:无法读取未定义的属性&#39;fire&#39;” - [Vue warn]: Error in v-on handler: “TypeError: Cannot read property 'fire' of undefined” 无法读取 null 的属性“hasAttribute” - Cannot read property 'hasAttribute' of null TypeError 无法读取 null 的属性“1” - TypeError Cannot read property '1' of null laravel Vue.js:渲染错误:“TypeError:无法读取 null 的属性‘用户’” - laravel Vue.js : Error in render: "TypeError: Cannot read property 'user' of null" Laravel 5.1和Vue.js-21678未捕获(承诺)TypeError:无法读取null的属性&#39;data&#39; - Laravel 5.1 and Vue.js - 21678 Uncaught (in promise) TypeError: Cannot read property 'data' of null TypeError:无法读取 Vue 中未定义的属性“id” - TypeError :Cannot read property 'id' of undefined in Vue 无法读取 vue js 中未定义的属性“reduce” - Cannot read property 'reduce' of undefined in vue js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM