目录
1、报错代码:
2、错误代码如下:
//仓库中的js代码为:
const state = {
goodInfo: {}
};
const getters = {
categoryView(state) {
return state.goodInfo.categoryView;
}
};
//html中代码为:
<span v-show="categoryView.category1Name">{ {categoryView.category1Name}}</span>
3、错误原因:
state.goodInfo初始状态为空对象,空对象的categoryView属性值为undefined,简单来说就是空对象的属性值为undefined。
4、改正方法:
在初始化