1
1
<template >
2
2
<div class =" archives-content" style =" margin-top : 50px " >
3
- <div class =" block" >
3
+ <div class =" block" >
4
4
<el-timeline >
5
- <el-timeline-item timestamp =" 2018/4/12 " placement =" top" icon =" el-icon-loading" >
5
+ <el-timeline-item v-for = " item in ArchivesArray " : timestamp =" item.frontmatter.date " placement =" top" icon =" el-icon-loading" >
6
6
<el-card >
7
- <h4 >更新 Github 模板</h4 >
8
- <p >王小虎 提交于 2018/4/12 20:46</p >
7
+ <p class =" article-title" ><router-link :to =" item.regularPath" >{{ item.frontmatter.title}}</router-link ></p >
8
+ <p >Finen于{{ item.frontmatter.date}}发布该文章</p >
9
+ <!-- <el-tag>原创</el-tag><br/> -->
10
+ <div class =" archives-tag" >
11
+ <p class =" article-tag" >Tags: <el-tag v-for =" tag in item.frontmatter.tags" >{{tag}}</el-tag ></p >
12
+ </div >
9
13
</el-card >
10
14
</el-timeline-item >
11
-
12
15
</el-timeline >
13
16
</div >
14
17
</div >
@@ -23,98 +26,52 @@ export default {
23
26
default: []
24
27
}
25
28
},
26
- data () {
29
+ data () {
27
30
return {
28
- selectedTags: []
29
- };
31
+ ArchivesArray: []
32
+ }
33
+ },
34
+ mounted : function () {
35
+ this .filterListFun ()
30
36
},
31
37
computed: {
32
- filteredList () {
33
- if (this .pages ) {
34
- return this .pages
35
- .filter (item => {
36
- const isBlogPost = !! item .frontmatter .blog ;
37
- const isReadyToPublish =
38
- new Date (item .frontmatter .date ) <= new Date ();
39
- // check if tags contain any of the selected tags
40
- // const hasTags = item.frontmatter.tags && item.frontmatter.tags.some(tag => this.selectedTags.includes(tag))
41
- // check if tags contain all of the selected tags
42
- const hasTags =
43
- !! item .frontmatter .tags &&
44
- this .selectedTags .every (tag =>
45
- item .frontmatter .tags .includes (tag)
46
- );
47
- if (
48
- ! isBlogPost ||
49
- ! isReadyToPublish ||
50
- (this .selectedTags .length > 0 && ! hasTags)
51
- ) {
52
- return false ;
53
- }
54
- return true ;
55
- })
56
- .sort (
57
- (a , b ) =>
58
- new Date (b .frontmatter .date ) - new Date (a .frontmatter .date )
59
- );
60
- }
38
+ // 用于刷选frontmatter中有post: true的数据
39
+ filterList () {
40
+
61
41
}
42
+
43
+ // 将筛选出来的数据进行时间排序
62
44
},
63
45
methods: {
64
- getYears : function () {
65
- return [
66
- ... new Set (
67
- this .filteredList .map (item =>
68
- new Date (item .frontmatter .date ).getFullYear ()
69
- )
70
- )
71
- ];
72
- },
73
- getMonths : function (year ) {
74
- return [
75
- ... new Set (
76
- this .filteredList
77
- .filter (
78
- item => new Date (item .frontmatter .date ).getFullYear () == year
79
- )
80
- .map (item => new Date (item .frontmatter .date ).getMonth ())
81
- )
82
- ];
83
- },
84
- postsByDate (year , month ) {
85
- return this .filteredList .filter (item => {
86
- const date = new Date (item .frontmatter .date );
87
- return date .getFullYear () == year && date .getMonth () == month;
46
+ filterListFun () {
47
+ this .pages .forEach (element => {
48
+ if (element .frontmatter .post == true ){
49
+ this .ArchivesArray .push (element);
50
+ }
88
51
});
89
52
}
90
- },
91
- filters: {
92
- // Filter definitions
93
- monthToLongName (value ) {
94
- const months = [
95
- " January" ,
96
- " February" ,
97
- " March" ,
98
- " April" ,
99
- " May" ,
100
- " June" ,
101
- " July" ,
102
- " August" ,
103
- " September" ,
104
- " October" ,
105
- " November" ,
106
- " December"
107
- ];
108
- return months[value];
109
- }
110
53
}
111
- };
112
- console .log (" sss" );
54
+ }
113
55
</script >
114
56
<style >
115
57
.el-timeline-item__content > .el-card > .el-card__body {
116
58
text-align : left ;
117
59
}
60
+ .el-card > .el-card__body > .article-title {
61
+ font-size : 20px ;
62
+ font-weight : 600 ;
63
+ font-family : " Helvetica Neue" , Helvetica , " PingFang SC" , " Hiragino Sans GB" ,
64
+ " Microsoft YaHei" , " 微软雅黑" , Arial , sans-serif ;
65
+ }
66
+ .archives-tag > .article-tag {
67
+ font-size : 16px ;
68
+ font-weight : 500 ;
69
+ font-family : " Helvetica Neue" , Helvetica , " PingFang SC" , " Hiragino Sans GB" ,
70
+ " Microsoft YaHei" , " 微软雅黑" , Arial , sans-serif ;
71
+ }
72
+ .archives-tag > .article-tag > .el-tag {
73
+ margin-left : 5px ;
74
+ }
118
75
</style >
119
76
120
77
0 commit comments