From 9b67af6323b599ae4fc7d81d2cb68cd46a34cb51 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Tue, 4 Nov 2025 09:12:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=BF=87=E6=BB=A4=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/article/index.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/pages/article/index.vue b/app/pages/article/index.vue index 86ba2ab..9f5d3ea 100644 --- a/app/pages/article/index.vue +++ b/app/pages/article/index.vue @@ -58,6 +58,8 @@ const fetchArticles = async () => { } } + + // 监听分页变化 watch(page, () => { fetchArticles() @@ -66,8 +68,9 @@ watch(page, () => { }) // 监听查询参数变化 -watch(() => route.query.code, (newCode) => { - if (!newCode && newCode !== code.value) { +watch(() => route.query.code, (newCode, oldCode) => { + // 当 code 参数发生变化时(包括从有值变为无值,或从一个值变为另一个值) + if (newCode !== oldCode) { page.value = 1 fetchArticles() } @@ -90,7 +93,7 @@ onMounted(() => {