Showing
3 changed files
with
20 additions
and
2 deletions
@@ -51,6 +51,11 @@ export default { | @@ -51,6 +51,11 @@ export default { | ||
51 | ArticleImage, | 51 | ArticleImage, |
52 | HorizontalSlide | 52 | HorizontalSlide |
53 | }, | 53 | }, |
54 | + props: { | ||
55 | + articleId: { | ||
56 | + required: true | ||
57 | + } | ||
58 | + }, | ||
54 | data() { | 59 | data() { |
55 | return { | 60 | return { |
56 | imageList: [ | 61 | imageList: [ |
@@ -66,6 +71,11 @@ export default { | @@ -66,6 +71,11 @@ export default { | ||
66 | userName: 'MOMO草' | 71 | userName: 'MOMO草' |
67 | }; | 72 | }; |
68 | }, | 73 | }, |
74 | + asyncData({store, router}) { | ||
75 | + const articleId = router.params.articleId; | ||
76 | + | ||
77 | + store.dispatch('/article/') | ||
78 | + }, | ||
69 | }; | 79 | }; |
70 | </script> | 80 | </script> |
71 | 81 |
@@ -6,7 +6,12 @@ export default [ | @@ -6,7 +6,12 @@ export default [ | ||
6 | }, | 6 | }, |
7 | { | 7 | { |
8 | name: 'ArticleDetail', | 8 | name: 'ArticleDetail', |
9 | - path: '/xianyu/article/detail', | ||
10 | - component: () => import(/* webpackChunkName: "articleDetail" */ './articleDetail') | 9 | + path: '/xianyu/article/detail/:articleId.html', |
10 | + component: () => import(/* webpackChunkName: "articleDetail" */ './articleDetail'), | ||
11 | + props({params}) { | ||
12 | + return { | ||
13 | + articleId: parseInt(params.articleId, 10) | ||
14 | + }; | ||
15 | + } | ||
11 | } | 16 | } |
12 | ]; | 17 | ]; |
-
Please register or login to post a comment