【代码优化】进入分类页的时候,自动勾选左侧一级分类(比如从首页进入)
parent
92b9820f20
commit
51ba185e81
|
@ -157,7 +157,7 @@
|
||||||
items: [{
|
items: [{
|
||||||
skuId: e.id,
|
skuId: e.id,
|
||||||
count: e.goods_num,
|
count: e.goods_num,
|
||||||
categoryId: state.goodsInfo.categoryId
|
categoryId: state.goodsInfo.categoryId
|
||||||
}]
|
}]
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -196,7 +196,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分享信息 TODO 芋艿:待接入
|
// 分享信息
|
||||||
const shareInfo = computed(() => {
|
const shareInfo = computed(() => {
|
||||||
if (isEmpty(unref(activity))) return {};
|
if (isEmpty(unref(activity))) return {};
|
||||||
return sheep.$platform.share.getShareInfo(
|
return sheep.$platform.share.getShareInfo(
|
||||||
|
|
|
@ -133,16 +133,11 @@
|
||||||
|
|
||||||
onLoad(async (params) => {
|
onLoad(async (params) => {
|
||||||
await getList();
|
await getList();
|
||||||
|
|
||||||
// 首页点击分类的处理:查找满足条件的分类
|
// 首页点击分类的处理:查找满足条件的分类
|
||||||
const foundCategory = state.categoryList.find(category => category.id == params.id);
|
const foundCategory = state.categoryList.find(category => category.id === params.id);
|
||||||
// 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
|
// 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类
|
||||||
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
|
onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
|
||||||
|
|
||||||
// 如果是 first 风格,需要加载商品分页
|
|
||||||
if (state.style === 'first_one' || state.style === 'first_two') {
|
|
||||||
onMenu(0);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
|
|
Loading…
Reference in New Issue