fanfan 9 months ago
commit 792fc6c7b3
  1. 42
      pages/index/index.vue

@ -670,7 +670,26 @@
}).then(res => { }).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.tabList = res.data.list; this.tabList = res.data.list;
this.catagoryList = res.data.list[0].children || []
let arr = [], total = (this.tabList && this.tabList.length > 0 ?this.tabList[0].children.length:0)
if(this.tabList[0].children && this.tabList[0].children.length > 0){
this.tabList[0].children.map(a=>{
arr.push(a)
})
}
if(5- total >= 0 && arr.length > 0){
this.tabList[0].children.map(a=>{
if(a.children && a.children.length > 0){
a.children.map((b,idx)=>{
if(idx < (20-arr.length)){
arr.push(b)
}
})
}
})
}
this.catagoryList = arr;
// this.catagoryList = res.data.list[0].children || []
if (this.current == 0) { if (this.current == 0) {
this.getRankingList(this.tabList[0].category_id) this.getRankingList(this.tabList[0].category_id)
// this.getNewGoods(this.tabList[0].category_id) // this.getNewGoods(this.tabList[0].category_id)
@ -700,7 +719,26 @@
}, },
changeGoodsType(index) { changeGoodsType(index) {
this.tabCurrent = index; this.tabCurrent = index;
this.catagoryList = this.tabList[index].children || []; this.isToggle = false;
let arr = [], total = this.tabList[index].children.length
if(this.tabList[index].children && this.tabList[index].children.length > 0){
this.tabList[index].children.map(a=>{
arr.push(a)
})
}
if(5- total >= 0 && arr.length > 0){
this.tabList[index].children.map(a=>{
if(a.children && a.children.length > 0){
a.children.map((b,idx)=>{
if(idx < (20-arr.length)){
arr.push(b)
}
})
}
})
}
// this.catagoryList = this.tabList[index].children || [];
this.catagoryList = arr
this.getRankingList(this.tabList[index].category_id) this.getRankingList(this.tabList[index].category_id)
// this.getNewGoods(this.tabList[index].category_id) // this.getNewGoods(this.tabList[index].category_id)
this.getNewGoods() this.getNewGoods()

Loading…
Cancel
Save