修复bug
This commit is contained in:
parent
0b9758ff3b
commit
8722da95d4
|
@ -20,7 +20,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class='headScoll' ref='headscroll' :style="{height:isScroll?'0':'200rpx'}">
|
||||
<scroll-view class="head-view" scroll-x>
|
||||
<scroll-view class="head-view" scroll-x @scrolltolower="getgoodClassList()">
|
||||
<view class="list">
|
||||
<view class="item" :class="{'item-active': topActive===item.id}"
|
||||
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
|
||||
|
@ -53,7 +53,7 @@
|
|||
</view>
|
||||
</viewPopup>
|
||||
<view class="scroll-box">
|
||||
<scroll-view class="left" scroll-y>
|
||||
<scroll-view class="left" scroll-y @scrolltolower="getgoodClassList(topActive)">
|
||||
<view class="item u-line-1" :class="{'item-active': leftActive===item.id}"
|
||||
v-for="(item, index) in goodClassTow" :key="index" @click="changeTwo(item, index)">{{item.name}}
|
||||
</view>
|
||||
|
@ -61,7 +61,7 @@
|
|||
</scroll-view>
|
||||
<view class="right">
|
||||
<view class="classify">
|
||||
<scroll-view style="height: 90rpx;" scroll-x>
|
||||
<scroll-view style="height: 90rpx;" scroll-x @scrolltolower="getgoodClassList(leftActive)">
|
||||
<view class="classify-list">
|
||||
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive===item.id}"
|
||||
v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
|
||||
|
@ -83,7 +83,7 @@
|
|||
</view>
|
||||
<viewPopup v-if="show===2" @close="show=0">
|
||||
<view class="cateOne">
|
||||
<scroll-view scroll-y style="height: 230rpx;">
|
||||
<scroll-view scroll-y style="height: 230rpx;" @scrolltolower="getgoodClassList(leftActive)">
|
||||
<view class="classify-list">
|
||||
<view class="classify-list-item u-line-1"
|
||||
:class="{'item-active': rightActive===item.id}"
|
||||
|
@ -211,7 +211,7 @@
|
|||
leftActive.value = goodClassTow.value[0]?.id || '';
|
||||
rightActive.value = goodClassThree.value[0]?.id || '';
|
||||
getGoodList();
|
||||
if (!item.isLoading) getgoodClassList(topActive.value); // 判断是否加载过数据, 加载过则不进行加载,节约资源
|
||||
if (!item.isLoading && item.id) getgoodClassList(topActive.value); // 判断是否加载过数据, 加载过则不进行加载,节约资源
|
||||
}
|
||||
|
||||
const leftActive = ref(0);
|
||||
|
@ -222,7 +222,7 @@
|
|||
goodClassThree.value = item?.children || [];
|
||||
rightActive.value = goodClassThree.value[0]?.id || '';
|
||||
getGoodList();
|
||||
if (!item.isLoading) getgoodClassList(leftActive.value); // 判断是否加载过数据, 加载过则不进行加载,节约资源
|
||||
if (!item.isLoading && item.id) getgoodClassList(leftActive.value); // 判断是否加载过数据, 加载过则不进行加载,节约资源
|
||||
}
|
||||
|
||||
const rightActive = ref(0);
|
||||
|
@ -297,10 +297,14 @@
|
|||
const goodClassList = ref([]); // 一级分类
|
||||
const goodClassTow = ref([]); // 二级分类
|
||||
const goodClassThree = ref([]); // 三级分类
|
||||
const classMap = new Map();
|
||||
const getgoodClassList = (pid = 0) => {
|
||||
let page_no = classMap.get(pid) || 1;
|
||||
console.log(classMap.get(pid));
|
||||
goodClassListApi({
|
||||
pid: pid,
|
||||
page_size: 10000
|
||||
page_no: page_no,
|
||||
page_size: 30
|
||||
}).then(res => {
|
||||
if (pid == 0) { // 加载一级分类时设置全部分类
|
||||
res.data?.lists?.unshift({
|
||||
|
@ -368,6 +372,8 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
page_no++;
|
||||
classMap.set(pid, page_no);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue