发布时间:2023-11-05 14:30
vue.runtime.esm.js?c320:4560 [Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading ‘category1Id’)"
found in
—> at src/pages/Detail/index.vue
at src/App.vue
所以我们在return 后面的返回值加上 或 || {}
,因为一开始的初始值就是个空对象
// 简化数据
const getters = {
// 获取数据的时候直接getters获取然后categoryView来获取数据
categoryView(state){
// 比如:state.goodsInfo初始状态为空对象,空对象的categoryView属性为undefined,读属性undefined的xxx会报错
return state.goodsInfo.categoryView || {};
},
};
运筹学修炼日记:TSP中两种不同消除子环路的方法及callback实现(Python调用Gurobi求解,附以王者荣耀视角解读callback的工作逻辑)
PyTorch学习笔记:RuntimeError: one of the variables needed for gradient computation has been modified by
Linux系统下shell脚本实战之mariadb创建数据库和表
【第06天】给定一个两个坐标(x1,y1)和(x2,y2),求两点距离与斜率 | 浮点数精度问题