vue.runtime.esm.js?c320:4605 [Vue warn]: Error in render: "TypeError: Cannot read property 'state' of undefined"
时间: 2023-10-17 19:35:31 浏览: 170
Vue.js前端 JavaScript 框架
这个错误是由于在渲染时尝试访问一个未定义的属性'state'引起的。根据引用[3]的内容,这个错误可能是因为你没有正确处理初始状态为空对象的情况。在你的getters函数中,你可以添加一个空对象的默认返回值来避免这个错误。通过在return语句后面添加"|| {}",即使state.goodsInfo初始值为空对象,也会返回一个空对象作为默认值。这样,就不会再出现"Cannot read property 'state' of undefined"的错误了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [报错 | vue.runtime.esm....c320:4560 [Vue warn]: Error in render: “TypeError: Cannot read properties of](https://blog.csdn.net/muziqwyk/article/details/126191223)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [【报错】vue.runtime.esm.js?c320:4605 [Vue warn]: Duplicate keys detected: ‘40825‘. This may cause ...](https://blog.csdn.net/qq_40797578/article/details/128266387)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文