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 @@