11<template >
22 <div class =" tags-wrapper" :class =" recoShow?'reco-show': 'reco-hide'" >
33 <Common :sidebar =" false" :isComment =" false" ></Common >
4- <div class =" tags" >
5- <span
6- v-for =" (item, index) in tags"
7- :key =" index"
8- :class =" {'active': item.name == currentTag}"
9- :style =" { 'backgroundColor': item.color }"
10- @click =" tagClick(item.name)" >{{item.name}}</span >
11- </div >
4+ <TagList :currentTag =" currentTag" @getCurrentTag =" tagClick" ></TagList >
125 <note-abstract
136 class =" list"
147 :data =" posts"
2619
2720<script >
2821import Common from ' @theme/components/Common.vue'
22+ import TagList from ' @theme/components/TagList.vue'
2923import NoteAbstract from ' @theme/components/NoteAbstract.vue'
30- import mixin from ' @theme/mixins/index.js'
3124
3225export default {
33- mixins: [mixin],
34- components: { Common, NoteAbstract },
35-
26+ components: { Common, NoteAbstract, TagList },
3627 data () {
3728 return {
3829 posts: [],
@@ -43,7 +34,6 @@ export default {
4334 allTagName: ' 全部'
4435 }
4536 },
46-
4737 computed: {
4838 // 时间降序后的博客列表
4939 handlePosts () {
@@ -58,17 +48,9 @@ export default {
5848 return posts
5949 }
6050 },
61-
6251 created () {
6352 if (this .$tags .list .length > 0 ) {
6453 const currentTag = this .$route .query .tag ? this .$route .query .tag : this .currentTag
65- const tags = this .$tags .list
66- tags .map (item => {
67- const color = this ._tagColor ()
68- item .color = color
69- return tags
70- })
71- this .tags = [{ name: ' 全部' , color: this ._tagColor () }, ... tags]
7254
7355 this .getPagesByTags (currentTag)
7456 }
@@ -135,24 +117,6 @@ export default {
135117 max-width : 740px ;
136118 margin : 0 auto ;
137119 padding : 4.6rem 2.5rem 0 ;
138- .tags
139- margin 30px 0
140- span
141- vertical-align : middle ;
142- margin : 4px 4px 10px ;
143- padding : 4px 8px ;
144- display : inline-block ;
145- cursor : pointer ;
146- border-radius : 2px ;
147- background : #f f f ;
148- color : #f f f ;
149- font-size : 13px ;
150- box-shadow 0 1px 4px 0 rgba (0 ,0 ,0 ,0.2 )
151- transition : all .5s
152- & :hover
153- transform scale (1.04 )
154- & .active
155- transform scale (1.2 )
156120 & .reco-hide {
157121 .tags , .list , .pagation {
158122 load-start ()
0 commit comments