商品列表三四级分类重复

main
shuxiaoquan 7 months ago
parent 334ed82f05
commit 27cac4c7f3
  1. 22
      pages/goods/list.vue

@ -12,7 +12,7 @@
<template v-if="options.categoryId">
<view class="goodsban" v-if="tabbar && tabbar.length > 0">
<scroll-view class="typeList" scroll-x="true">
<view v-for="(item,index) in tabbar" :key="index" class="bandsImg" @click="onChage(item,1)"
<view v-for="(item,index) in tabbar" :key="index" class="bandsImg" @click="onChage(item,1,index)"
:style="{'color':item.category_id==isBanrdActive?'#F43B21':'#5A5A5A','border':item.category_id==isBanrdActive?'1rpx solid #F22029':'1rpx solid #E7E7E7'}">
<image :src="item.image?item.image.external_url:''" mode="aspectFill"></image>
<view class="typeItem">{{item.name}}</view>
@ -329,19 +329,25 @@
.then(res => {
if (res.data.list.length > 0) {
that.tabbar = res.data.list;
res.data.list.forEach(item => {
item.children.forEach(item_1 => {
that.goodsType.push(item_1)
})
});
console.log(that.goodsType, that.tabbar)
// res.data.list.forEach(item => {
// item.children.forEach(item_1 => {
// that.goodsType.push(item_1)
// })
// });
// console.log(that.goodsType, that.tabbar)
}
})
.catch(reject)
})
},
onChage(item, type) {
onChage(item, type,index) {
if (type == 1) {
if(this.tabbar && this.tabbar[index].children && this.tabbar[index].children.length > 0){
this.goodsType= this.tabbar[index].children;
}
this.isActive = '';
this.keyName2 = ''
if (item.category_id == this.isBanrdActive) {
this.isBanrdActive = '';
this.keyName1 = ''

Loading…
Cancel
Save