hookehuyr

产品详情页路由调整

......@@ -51,11 +51,7 @@ export default {
},
goToDetail (v) { // 跳转产品详情
this.$router.push({
path: '/product/detail',
query: {
id: v.id,
timestamp: Date.now()
}
path: `/product/detail${v.id}/${Date.now()}`,
});
}
}
......
......@@ -382,12 +382,7 @@ export default {
},
goToP (item) { // 跳转产品详情
this.$router.push({
path: '/product/detail',
query: {
id: item.id,
category_id: item.category_id,
timestamp: Date.now()
}
path: `/product/detail/${item.id}/${item.category_id}/${Date.now()}`,
});
this.closeMenu();
},
......
<!--
* @Date: 2024-10-10 10:37:16
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:39:03
* @LastEditTime: 2024-12-12 13:50:39
* @FilePath: /hager/src/components/hagerMenu.vue
* @Description: 文件描述
-->
......@@ -149,10 +149,7 @@ export default {
goToThird(id) {
this.$emit("close");
this.$router.push({
path: "/product/detail",
query: {
id: id,
},
path: `/product/detail/${id}`,
});
},
//
......
/*
* @Date: 2024-08-26 10:42:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:38:22
* @LastEditTime: 2024-12-12 13:51:12
* @FilePath: /hager/src/route.js
* @Description: 文件描述
*/
......@@ -24,7 +24,25 @@ export default [{
},
children: []
}, {
path: '/product/detail',
path: '/product/detail/:id',
name: '详情页',
component: () => import('@/views/product/detail'),
meta: {
title: '海格电气',
tag: 'product'
},
children: []
}, {
path: '/product/detail/:id/:timestamp',
name: '详情页',
component: () => import('@/views/product/detail'),
meta: {
title: '海格电气',
tag: 'product'
},
children: []
}, {
path: '/product/detail/:id/:category_id/:timestamp',
name: '详情页',
component: () => import('@/views/product/detail'),
meta: {
......
<!--
* @Date: 2024-09-29 14:26:41
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-06 15:34:53
* @LastEditTime: 2024-12-12 13:54:06
* @FilePath: /hager/src/views/product/detail.vue
* @Description: 文件描述
-->
......@@ -204,7 +204,7 @@ export default {
},
watch: {
// 监听路由参数变化时,更新输入框的值
async '$route.query.id' (val, old) {
async '$route.params.id' (val, old) {
if (old !== val) {
this.getInfo();
}
......@@ -253,7 +253,7 @@ export default {
checked_sum: 0,
}];
this.info_images = [];
const { code, data } = await getProductInfoAPI( { id: this.$route.query.id });
const { code, data } = await getProductInfoAPI( { id: this.$route.params.id });
if (code) {
this.info = data;
this.keyword = data.post_keyword;
......
<!--
* @Date: 2024-09-27 16:53:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:44:08
* @LastEditTime: 2024-12-12 13:55:31
* @FilePath: /hager/src/views/product/index.vue
* @Description: 文件描述
-->
......@@ -168,11 +168,7 @@ export default {
},
goToDetail (v) { // 跳转产品详情
this.$router.push({
path: '/product/detail',
query: {
id: v.id,
category_id: this.$route.query.id
}
path: `/product/detail/${v.id}/${this.$route.params.id}/${Date.now()}`
});
},
async getAllMain () { // 查询所有产品列表数据
......
<!--
* @Date: 2024-10-20 16:57:48
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 12:48:21
* @LastEditTime: 2024-12-12 13:52:16
* @FilePath: /hager/src/views/search.vue
* @Description: 文件描述
-->
......@@ -243,12 +243,7 @@ export default {
},
goToDetail (v) { // 跳转产品详情
this.$router.push({
path: '/product/detail',
query: {
id: v.id,
category_id: v.category_id,
timestamp: Date.now()
}
path: `/product/detail/${v.id}/${v.category_id}/${Date.now()}`,
});
},
goToCase (id) {
......@@ -261,10 +256,7 @@ export default {
},
goToSolution (v) { // 跳转产品详情
this.$router.push({
path: '/product/detail',
query: {
id: v.id
}
path: `/product/detail/${v.id}`,
});
},
goToSuccess (v) { // 跳转成功案例
......
<!--
* @Date: 2024-09-29 15:49:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-11 17:21:35
* @LastEditTime: 2024-12-12 13:53:39
* @FilePath: /hager/src/views/solution/detail.vue
* @Description: 文件描述
-->
......@@ -250,10 +250,7 @@ export default {
},
goToProduct (v) {
this.$router.push({
path: '/product/detail',
query: {
id: v.id
}
path: `/product/detail/${v.id}}`,
});
},
goToCase (v) {
......