1
1
<template >
2
2
<div class =" box-container" >
3
- <a v-for =" (item, index) in items" :key =" index" :href =" item.l" class =" box" target =" _blank" >
3
+ <a
4
+ v-for =" (item, index) in items"
5
+ :key =" index"
6
+ :href =" item.link"
7
+ :name =" item.name"
8
+ :title =" item.name"
9
+ class =" box"
10
+ target =" _blank"
11
+ >
4
12
<div class =" box-content" >
5
- <span v-if =" item.ct " class =" ct " >{{ item.ct }}</span >
6
- <span v-if =" isImage(item.i )" class =" icon-container" >
7
- <img :src =" item.i " alt =" icon" class =" i " />
13
+ <span v-if =" item.tag " class =" tag " >{{ item.tag }}</span >
14
+ <span v-if =" isImage(item.icon )" class =" icon-container" >
15
+ <img :src =" item.icon " alt =" icon" class =" icon-container " />
8
16
</span >
9
- <span v-else class =" icon-container " >
10
- <i :class =" item.i + ' fa-2xl'" :style =" { color: item.color }" ></i >
17
+ <span v-else class =" icon" >
18
+ <i :class =" item.icon + ' fa-2xl'" :style =" { color: item.color }" ></i >
11
19
</span >
12
- <img v-if =" item.light" :src =" item.light" alt =" icon" class =" i light-only" />
13
- <img v-if =" item.dark" :src =" item.dark" alt =" icon" class =" i dark-only" />
14
- <p class =" t " >{{ item.t }}</p >
20
+ <img v-if =" item.light" :src =" item.light" alt =" icon" class =" icon-container light-only" />
21
+ <img v-if =" item.dark" :src =" item.dark" alt =" icon" class =" icon-container dark-only" />
22
+ <p class =" name " >{{ item.name }}</p >
15
23
</div >
16
24
</a >
17
25
</div >
@@ -25,13 +33,12 @@ export default {
25
33
type: Array ,
26
34
required: true ,
27
35
validator : (items ) => {
28
- // 验证每个项是否有必须的属性
29
36
return items .every (
30
37
(item ) =>
31
- item .hasOwnProperty (' l ' ) &&
32
- item .hasOwnProperty (' i ' ) &&
33
- item .hasOwnProperty (' t ' ) &&
34
- item .hasOwnProperty (' ct ' ) &&
38
+ item .hasOwnProperty (' link ' ) &&
39
+ item .hasOwnProperty (' icon ' ) &&
40
+ item .hasOwnProperty (' name ' ) &&
41
+ ( item .hasOwnProperty (' tag ' ) || true ) &&
35
42
(item .hasOwnProperty (' light' ) || item .hasOwnProperty (' dark' ))
36
43
)
37
44
}
@@ -65,16 +72,16 @@ export default {
65
72
position : relative ;
66
73
border : 1px solid var (--vp-c-bg-soft );
67
74
background-color : var (--vp-c-bg-alt );
68
- padding : 12 px 24 px ;
69
- border-radius : 8 px ;
70
- height : 60 px ;
71
- width : 210 px ;
75
+ padding : 0.8 rem 1.6 rem ;
76
+ border-radius : 0.8 rem ;
77
+ width : 12.25 rem ;
78
+ height : 3.5 rem ;
72
79
display : flex ;
80
+ text-decoration : none !important ;
73
81
transition : all 0.3s cubic-bezier (0.25 , 0.8 , 0.25 , 1 );
74
82
75
83
& :hover {
76
84
border-color : var (--vp-c-brand-1 );
77
- // background-color: var(--vp-c-brand-soft);
78
85
}
79
86
80
87
@media (max-width : 1024px ) {
@@ -89,7 +96,7 @@ export default {
89
96
}
90
97
91
98
.box-content {
92
- font-size : 14 px ;
99
+ font-size : 0.9 rem ;
93
100
line-height : 1 ;
94
101
letter-spacing : -0.02em ;
95
102
display : flex ;
@@ -99,38 +106,37 @@ export default {
99
106
white-space : nowrap ;
100
107
}
101
108
102
- .ct {
109
+ .tag {
103
110
position : absolute ;
104
111
top : 0 ;
105
112
right : 0 ;
106
113
background-color : var (--vp-c-brand-3 );
107
114
color : var (--vp-c-brand-text );
108
- font-size : 10 px ;
109
- padding : 4 px 8 px ;
110
- border-top-right-radius : 8 px ;
111
- border-bottom-left-radius : 4 px ;
115
+ font-size : 0.5 rem ;
116
+ padding : 0.25 rem 0.5 rem ;
117
+ border-top-right-radius : 0.7 rem ;
118
+ border-bottom-left-radius : 0.7 rem ;
112
119
z-index : 1 ;
113
120
}
114
-
115
- .i {
116
- margin-right : 8px ;
121
+ .icon-container {
117
122
height : 2em ;
118
- width : auto ;
119
123
display : flex ;
120
124
justify-content : center ;
121
125
align-items : center ;
122
- border-radius : 6px ;
123
126
}
124
127
125
- .icon-container {
126
- // display: flex;
127
- // justify-content: center;
128
- // align-items: center;
129
- margin-right : 8px ;
128
+ .icon {
129
+ display : inline-block ;
130
+ height : 2em ;
131
+ justify-content : center ;
132
+ align-items : center ;
133
+ margin-top : 1rem ;
134
+ color : var (--vp-c-text-1 );
130
135
}
131
136
132
- .t {
133
- font-size : 14px ;
137
+ .name {
138
+ margin-left : 1rem ;
139
+ font-size : 0.8rem ;
134
140
line-height : 1 ;
135
141
letter-spacing : -0.02em ;
136
142
display : flex ;
0 commit comments