2
2
import { ref , watchEffect } from ' vue' ;
3
3
import { useRoute } from ' vue-router' ;
4
4
import { REPO_PATH } from ' ./constants' ;
5
+ import dayjs from ' dayjs' ;
5
6
6
7
defineProps ({
7
8
isZn: Boolean ,
8
9
});
10
+
9
11
const route = useRoute ();
10
12
const contributors = ref ([]);
13
+ const lastCommitTime = ref (0 );
14
+
11
15
const filterData = data => {
12
16
const arr = [];
13
17
data .forEach (item => {
14
18
if (!! item .author ?.login || !! item .author ?.html_url || !! item .author ?.avatar_url ) {
19
+ lastCommitTime .value = Math .max (lastCommitTime .value , + new Date (item .commit .author .date ));
20
+
15
21
arr .push ({
16
22
login: item .author .login ,
17
23
url: item .author .html_url ,
@@ -46,18 +52,33 @@ watchEffect(() => {
46
52
</script >
47
53
48
54
<template >
49
- <ul v-if =" contributors.length > 0" class =" acss-1ppw8kl" >
50
- <li v-for =" item in contributors" :key =" item.login" >
51
- <a-tooltip :title =" `${isZn ? '文档贡献者:' : 'contribotors: '}${item.login}`" >
52
- <a :href =" item.url" target =" _blank" >
53
- <a-avatar :src =" item.avatar" size =" small" />
54
- </a >
55
- </a-tooltip >
56
- </li >
57
- </ul >
55
+ <div class =" contributors-list" >
56
+ <ul v-if =" contributors.length > 0" class =" acss-1ppw8kl" >
57
+ <li v-for =" item in contributors" :key =" item.login" >
58
+ <a-tooltip :title =" `${isZn ? '文档贡献者:' : 'Contributor: '}${item.login}`" >
59
+ <a :href =" item.url" target =" _blank" >
60
+ <a-avatar :src =" item.avatar" size =" small" />
61
+ </a >
62
+ </a-tooltip >
63
+ </li >
64
+ </ul >
65
+ <span >
66
+ {{ isZn ? '最后更新' : 'Last updated' }} : {{ dayjs(lastCommitTime).format('YYYY/MM/DD') }}
67
+ </span >
68
+ </div >
58
69
</template >
59
70
60
71
<style scoped>
72
+ .contributors-list {
73
+ margin-top : 120px !important ;
74
+ display : flex ;
75
+ gap : 8px ;
76
+ }
77
+
78
+ .contributors-list span {
79
+ color : var (--primary-color );
80
+ }
81
+
61
82
.acss-1ppw8kl {
62
83
display : -webkit-box ;
63
84
display : -webkit-flex ;
@@ -67,8 +88,8 @@ watchEffect(() => {
67
88
-webkit-flex-wrap : wrap ;
68
89
-ms-flex-wrap : wrap ;
69
90
flex-wrap : wrap ;
70
- margin-top : 120px !important ;
71
91
clear : both ;
92
+ flex : 1 ;
72
93
}
73
94
74
95
.acss-1ppw8kl li {
0 commit comments