From bc0e731fc3d758de134963faa5457861f2e025a7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 4 Jan 2025 09:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=20categoryId=20=E5=8C=B9=E9=85=8D=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/category.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/index/category.vue b/pages/index/category.vue index f316b6aa..8111bf73 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -23,7 +23,7 @@ scroll-y :style="[{ height: pageHeight + 'px' }]" v-if="state.categoryList?.length" - @scrolltolower="handleScrollToLower" + @scrolltolower="handleScrollToLower" > category.id === params.id); + const foundCategory = state.categoryList.find((category) => category.id === Number(params.id)); // 如果找到则调用 onMenu 自动勾选相应分类,否则调用 onMenu(0) 勾选第一个分类 onMenu(foundCategory ? state.categoryList.indexOf(foundCategory) : 0); }); function handleScrollToLower() { loadMore(); - }; + }