简化数据时 让数据有两种状
<!-- 导航路径区域 -->
<div class="conPoin">
<span v-show="categoryView.category1Name">{{ categoryView.category1Name }}</span>
<span v-show="categoryView.category2Name">{{ categoryView.category2Name }}</span>
<span v-show="categoryView.category3Name">{{ categoryView.category3Name }}</span>
</div>
import { mapGetters } from "vuex";
computed: {
...mapGetters(["categoryView","skuInfo","spuSaleAttrList"]),
},
const getters = {
categoryView(state) {
return state.goodInfo.categoryView || {}
},
skuInfo(state){
return state.goodInfo.skuInfo || {}
},
spuSaleAttrList(){
return state.goodInfo.spuSaleAttrList
}
};
态 一获取到数据,二是 || [] 根据数据的类型判断是数组还是对象