hookehuyr

修改新闻中心路由参数跳转操作

1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-10 16:01:00 4 + * @LastEditTime: 2024-12-12 12:47:30
5 * @FilePath: /hager/src/route.js 5 * @FilePath: /hager/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -141,7 +141,7 @@ export default [{ ...@@ -141,7 +141,7 @@ export default [{
141 }, 141 },
142 children: [] 142 children: []
143 }, { 143 }, {
144 - path: '/news/detail', 144 + path: '/news/detail/:id',
145 name: '新闻详情', 145 name: '新闻详情',
146 component: () => import('@/views/news/detail'), 146 component: () => import('@/views/news/detail'),
147 meta: { 147 meta: {
......
1 <!-- 1 <!--
2 * @Date: 2024-08-27 10:06:30 2 * @Date: 2024-08-27 10:06:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-11 15:16:27 4 + * @LastEditTime: 2024-12-12 12:48:04
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -308,10 +308,7 @@ export default { ...@@ -308,10 +308,7 @@ export default {
308 }, 308 },
309 goToNew (v) { 309 goToNew (v) {
310 this.$router.push({ 310 this.$router.push({
311 - path: '/news/detail', 311 + path: `/news/detail/${v.id}`,
312 - query: {
313 - id: v.id
314 - }
315 }); 312 });
316 }, 313 },
317 goToNews () { 314 goToNews () {
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:06:09 2 * @Date: 2024-10-18 12:06:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-04 18:16:02 4 + * @LastEditTime: 2024-12-12 12:49:20
5 * @FilePath: /hager/src/views/news/detail.vue 5 * @FilePath: /hager/src/views/news/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
52 } 52 }
53 }, 53 },
54 async mounted () { 54 async mounted () {
55 - const { code, data } = await getNewsDetailAPI({ id: this.$route.query.id }); 55 + const { code, data } = await getNewsDetailAPI({ id: this.$route.params.id });
56 if (code) { 56 if (code) {
57 this.title = data.post_title; 57 this.title = data.post_title;
58 this.content = data.product_advantages; 58 this.content = data.product_advantages;
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:05:44 2 * @Date: 2024-10-18 12:05:44
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-03 16:26:23 4 + * @LastEditTime: 2024-12-12 12:48:45
5 * @FilePath: /hager/src/views/news/index.vue 5 * @FilePath: /hager/src/views/news/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -87,10 +87,7 @@ export default { ...@@ -87,10 +87,7 @@ export default {
87 methods: { 87 methods: {
88 goToNew (v) { 88 goToNew (v) {
89 this.$router.push({ 89 this.$router.push({
90 - path: '/news/detail', 90 + path: `/news/detail/${v.id}`,
91 - query: {
92 - id: v.id
93 - }
94 }); 91 });
95 }, 92 },
96 async getMore () { 93 async getMore () {
......
1 <!-- 1 <!--
2 * @Date: 2024-10-20 16:57:48 2 * @Date: 2024-10-20 16:57:48
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-04 16:00:08 4 + * @LastEditTime: 2024-12-12 12:48:21
5 * @FilePath: /hager/src/views/search.vue 5 * @FilePath: /hager/src/views/search.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -238,10 +238,7 @@ export default { ...@@ -238,10 +238,7 @@ export default {
238 }, 238 },
239 goToNews (id) { 239 goToNews (id) {
240 this.$router.push({ 240 this.$router.push({
241 - path: '/news/detail', 241 + path: `/news/detail/${id}`,
242 - query: {
243 - id: id
244 - }
245 }); 242 });
246 }, 243 },
247 goToDetail (v) { // 跳转产品详情 244 goToDetail (v) { // 跳转产品详情
......