进入分类页的时候自动勾选左侧一级分类

pull/74/head
卢越 2024-08-09 22:06:35 +08:00
parent fd83bcf02a
commit cc9f31f8c3
1 changed files with 6 additions and 8 deletions

View File

@ -133,14 +133,12 @@
onLoad(async (params) => { onLoad(async (params) => {
await getList(); await getList();
//
const cateList = state.categoryList //
for (let index = 0; index < cateList.length; index++) { const foundCategory = state.categoryList.find(category => category.id == params.id);
if (cateList[index].id == params.id) { // onMenu onMenu(0)
onMenu(index); onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0);
break;
}
}
// first // first
if (state.style === 'first_one' || state.style === 'first_two') { if (state.style === 'first_one' || state.style === 'first_two') {
onMenu(0); onMenu(0);