From a2e30e7bedc747c292c434a503e4184490446719 Mon Sep 17 00:00:00 2001 From: dzq Date: Fri, 20 Jun 2025 08:41:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(ProductList):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=80=9A=E8=BF=87URL=E5=8F=82=E6=95=B0shopId=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=BA=97=E9=93=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加从URL参数中获取shopId的功能,当shopId存在且在店铺列表中时自动选中对应店铺 --- src/pages/product/ProductList.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/product/ProductList.vue b/src/pages/product/ProductList.vue index ce53893..16998e1 100644 --- a/src/pages/product/ProductList.vue +++ b/src/pages/product/ProductList.vue @@ -137,10 +137,16 @@ const currentProducts = computed(() => { // 组件挂载时添加滚动监听 onMounted(() => { + const urlParams = new URLSearchParams(window.location.search); + const shopIdParam = urlParams.get('shopId') || undefined; + if (showShopList.value) { getShopListApi(wxStore.corpid).then((res) => { if (res?.code === 0 && res?.data?.length > 0) { shopList.value = res.data; + if (shopIdParam && shopList.value.some(shop => shop.shopId.toString() == shopIdParam)) { + handleShopSelect(parseInt(shopIdParam)); + } } }); } else {