Authored by shuaiguo

feat(笔记详情):增加接口调用

@@ -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 ];
@@ -5,6 +5,9 @@ export default function() { @@ -5,6 +5,9 @@ export default function() {
5 namespaced: true, 5 namespaced: true,
6 state: { 6 state: {
7 detailInfo: {} 7 detailInfo: {}
  8 + },
  9 + actions: {
  10 + [FETCH_DETAIL_INFO]() {}
8 } 11 }
9 }; 12 };
10 } 13 }