inleft
2022-01-23 6d105720dba848e7413fe6709f68d85f0a264fbf
commit | author | age
41b36f 1 <template>
I 2     <div class="swichTag">
3
4         <a-page-header title="归档时间线" style="padding: 0px;" @back="() => this.$router.go(-1)" />
5
6         <a-timeline pending="没有更多了...">
7             <a-icon slot="pendingDot" type="close-circle" style="font-size: 18px;" />
8             <div v-for="yearData in list">
9                 <a-divider orientation="left">
10                     {{yearData.year}}年
11                 </a-divider>
12
aab811 13                 <a-timeline-item v-for="monthData in yearData.monthList" color="white">
41b36f 14                     <a-icon slot="dot" type="clock-circle-o" style="font-size: 18px;" />
I 15                     <h3>{{monthData.month}}</h3>
16                     <div v-for="article in monthData.list">
17                         <span>{{article.name}} </span>{{article.remark}}
18                     </div>
19                 </a-timeline-item>
20             </div>
21         </a-timeline>
22     </div>
23 </template>
24
25 <script>
aab811 26     var tempList = [{
I 27             "year": "2022",
28             "monthList": [{
29                     "month": "9月18日",
30                     "list": [{
31                             "name": "陈奕迅-Body Song 歌词1",
32                             "remark": "随笔"
33                         },
34                         {
35                             "name": "vue动态路由异步加载",
36     
37                         }
38                     ]
39                 },
40                 {
41                     "month": "9月08日",
42                     "list": [{
43                         "name": "陈奕迅-Body Song 歌词1",
44                         "remark": "111"
45                     }]
46                 },
47                 {
48                     "month": "8月16日",
49                     "list": [{
50                             "name": "陈奕迅-Body Song 歌词1",
51                             "remark": "111"
52                         },
53                         {
54                             "name": "陈奕迅-Body Song 歌词1",
55     
56                         },
57                         {
58                             "name": "陈奕迅-Body Song 歌词2",
59                             "remark": "22"
60                         }
61                     ]
62                 },
63                 {
64                     "month": "4月09日",
65                     "list": [{
66                         "name": "陈奕迅-Body Song 歌词1",
67                         "remark": "111"
68                     }]
69                 },
70                 {
71                     "month": "3月18日",
72                     "list": [{
73                         "name": "陈奕迅-Body Song 歌词1",
74                         "remark": "111"
75                     }]
76                 },
77             ]
78         },
79         {
80             "year": "2021",
81             "monthList": [{
82                     "month": "9月18日",
83                     "list": [{
84                             "name": "陈奕迅-Body Song 歌词1",
85                             "remark": "随笔"
86                         },
87                         {
88                             "name": "vue动态路由异步加载",
89     
90                         }
91                     ]
92                 },
93                 {
94                     "month": "9月12日",
95                     "list": [{
96                         "name": "陈奕迅-Body Song 歌词1",
97                         "remark": "111"
98                     }]
99                 },
100                 {
101                     "month": "9月09日",
102                     "list": [{
103                         "name": "陈奕迅-Body Song 歌词1",
104                         "remark": "111"
105                     }]
106                 },
107                 {
108                     "month": "9月08日",
109                     "list": [{
110                         "name": "陈奕迅-Body Song 歌词1",
111                         "remark": "111"
112                     }]
113                 },
114     
115             ]
116         },
117         {
118             "year": "2020",
119             "monthList": [{
120                     "month": "9月18日",
121                     "list": [{
122                             "name": "陈奕迅-Body Song 歌词1",
123                             "remark": "随笔"
124                         },
125                         {
126                             "name": "vue动态路由异步加载",
127     
128                         }
129                     ]
130                 },
131                 {
132                     "month": "9月08日",
133                     "list": [{
134                         "name": "陈奕迅-Body Song 歌词1",
135                         "remark": "111"
136                     }]
137                 },
138                 {
139                     "month": "8月16日",
140                     "list": [{
141                             "name": "陈奕迅-Body Song 歌词1",
142                             "remark": "111"
143                         },
144                         {
145                             "name": "陈奕迅-Body Song 歌词1",
146     
147                         },
148                         {
149                             "name": "陈奕迅-Body Song 歌词2",
150                             "remark": "22"
151                         }
152                     ]
153                 }
154             ]
155         }
156     ]
157     
41b36f 158     export default {
I 159         props: {
160             'type': Number,
161         },
162         mounted() {
163             console.log(this.$route.query)
164         },
165
aab811 166         watch: {
I 167             '$route'(to, from) {
168                 var type = this.$route.query.type;
169                 var list = [];
170                 if (type == 1) {
171                     list = tempList;
172                 } else if (type == 2) {
173                     list.push(tempList[0]);
174                 } else if (type == 3) {
175                     list.push(tempList[1]);
41b36f 176                 }
aab811 177
I 178                 this.list = list
179             }
180         },
181
182         data() {
183         
41b36f 184
I 185             var list = [];
186             var type = this.$route.query.type;
187             if (type == 1) {
188                 list = tempList;
189             } else if (type == 2) {
190                 list.push(tempList[0]);
191             } else if (type == 3) {
192                 list.push(tempList[1]);
193             }
194
195             return {
196                 list: list
197             }
198         }
199     }
200 </script>
201
202
203 <style lang="less">
204     .ant-timeline-item-content {
205         span {
206             line-height: 30px;
207         }
208     }
209 </style>