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