inleft
2022-02-21 4b854c29227ef08ea178a3bba527a40ca2f84674
commit | author | age
41b36f 1 <template>
I 2     <div class="blog-container archive">
3         <span class="blog-pigeonhole">
4             <router-link to="/tagTime?type=1">
5                 归档信息
6             </router-link>
7         </span>
8         <div class="blog-scroll ">
9             <div v-for="yearData in myData">
10                 <router-link to="/tagTime?type=2">
aab811 11                     <p class="blog-pigeonhole-p">{{yearData.year}}年</p>
41b36f 12                 </router-link>
I 13                 <div class="blog-pigeonhole-list">
7b98c8 14
41b36f 15                     <div class="blog-pigeonhole-item" v-for="item in yearData.list">
I 16                         <router-link to="/tagTime?type=3">
17                             <span>{{item.month}}月</span>
18                         </router-link>
4b854c 19                         <span>{{item.count}}篇</span>
7b98c8 20
41b36f 21                     </div>
I 22                 </div>
23             </div>
24         </div>
25     </div>
26
27 </template>
28
29 <script>
4b854c 30     import {
I 31         archive
32     } from '../../api/blogStatistics.js'
41b36f 33     export default {
4b854c 34         beforeMount() {
I 35             archive({}).then((res) => {
36                 this.myData = res.data;
37             })
38         },
41b36f 39         data() {
I 40             return {
4b854c 41                 "myData": [
I 42                     // {
43                     //     "year": "2022",
44                     //     "list": [{
45                     //             "month": "12",
46                     //             "count": 10
47                     //         },
48                     //         {
49                     //             "month": "10",
50                     //             "count": 11
51                     //         },
52                     //         {
53                     //             "month": "9",
54                     //             "count": 9
55                     //         }
56                     //     ]
57                     // },
58                     // {
59                     //     "year": "2021",
60                     //     "list": [{
61                     //             "month": "12",
62                     //             "count": 8
63                     //         },
64                     //         {
65                     //             "month": "10",
66                     //             "count": 7
67                     //         },
68                     //         {
69                     //             "month": "7",
70                     //             "count": 4
71                     //         },
72                     //         {
73                     //             "month": "6",
74                     //             "count": 3
75                     //         },
76                     //         {
77                     //             "month": "5",
78                     //             "count": 2
79                     //         },
80                     //         {
81                     //             "month": "4",
82                     //             "count": 1
83                     //         }
84                     //     ]
85                     // }
41b36f 86                 ],
I 87             }
88         }
89     }
90 </script>
91
92 </script>
93
94 <style lang="less">
95     /*归档部分*/
96     .archive {
97         a {
98             color: black;
99         }
100     }
101
102     .blog-pigeonhole {
103         font-size: 15px;
104     }
105
106     .blog-pigeonhole-p {
107         width: 20%;
108         text-align: center;
109         line-height: 20px;
110         border-radius: 6px 6px 6px 6px;
111         /*background-color: #edf0f3;*/
112         margin-left: 3%;
113         margin-bottom: 3%;
114         opacity: 0.7;
115     }
116
117     .blog-pigeonhole-list {
118         line-height: 1.6;
119         padding-left: 3%;
120         padding-right: 3%;
121         /*display: flex; !*弹性盒子*!*/
122         /*justify-content: flex-end; !*在弹性盒对象的 <div> 元素中的各项周围留有空白:*!*/
123
124         display: flex;
125         display: -webkit-flex;
126         -webkit-justify-content: flex-start;
127         justify-content: flex-start;
128
129         flex-wrap: wrap;
130         /*让弹性盒元素在必要的时候拆行:*/
131         align-content: flex-start;
132         -webkit-align-content: flex-start;
133
134     }
135
136     .blog-pigeonhole-item {
137         min-width: 22%;
138         margin-left: 1.5%;
139         margin-right: 1.5%;
140         margin-bottom: 5%;
141
142         a span:first-child {
143             height: 22px;
144             background-color: #edf0f3;
145             border-radius: 6px 6px 0 0;
146             opacity: .8;
147             color: #999aaa;
148             line-height: 22px;
149             margin-bottom: 1px;
150             text-align: center;
151         }
152
153         a span:last-child {
154             height: 22px;
155             background-color: #f6f8fa;
156             border-radius: 0 0 6px 6px;
157             color: #555666;
158             line-height: 20px;
159             font-weight: 600;
160             text-align: center;
161         }
162
163         span {
164             display: block;
165         }
166     }
167 </style>