From 4a1a8085813fcc7e45a57cba23289315b7be7bfe Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Tue, 26 Mar 2024 15:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 2 +- src/views/product/info/detail/index.vue | 7 ++++--- src/views/product/info/index.vue | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 182d438..2fa4ea6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -80,7 +80,7 @@ export const constantRoutes = [ redirect: 'product-detail', children: [ { - path: 'product-detail', + path: 'product-detail/:detailId(\\d+)', component: () => import('@/views/product/info/detail/index'), name: 'Demo', meta: {title: '商品详情', icon: 'dashboard', affix: true} diff --git a/src/views/product/info/detail/index.vue b/src/views/product/info/detail/index.vue index 71cbdd0..cd7987a 100644 --- a/src/views/product/info/detail/index.vue +++ b/src/views/product/info/detail/index.vue @@ -131,7 +131,8 @@ export default { } }, created() { - this.initProjectDetailInfo(); + const detailId = this.$route.params && this.$route.params.detailId; + this.initProjectDetailInfo(detailId); }, methods: { initSku(){ @@ -154,8 +155,8 @@ export default { } this.checkSkuInfo = this.projectDetail.projectSkuInfoList.find(skuInfo => skuInfo.sku === sku) }, - initProjectDetailInfo(){ - getDetailInfo(3).then(response => { + initProjectDetailInfo(detailId){ + getDetailInfo(detailId).then(response => { this.projectDetail = response.data; this.projectDetail.productAttributeInfoList.map(productAttributeInfo => { let key = productAttributeInfo.attributeId; diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue index 1346ecd..5e8c755 100644 --- a/src/views/product/info/index.vue +++ b/src/views/product/info/index.vue @@ -115,6 +115,9 @@