简体   繁体   中英

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. 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

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. These guy will erase all the vue logs and warnings if we wanted our app in production state. Other method is if we install vue via npm then we should include the minified vue script inside our blade. Using minified will prevent warnings and logs inside your vue and it's good for production purposes.

Locate your vue js and enter the code below:

Vue.config.silent = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM