11
11
<div class =" proj-card-main" >
12
12
<img :src =" props.icon" alt =" icon" />
13
13
<div class =" proj-card-info" >
14
- <div class =" proj-card-title" :title =" props.title" >{{ props.title }}</div >
14
+ <div class =" proj-card-title" :title =" props.title" @click =" toProj()" >
15
+ {{ props.title }}
16
+ </div >
15
17
<div class =" proj-card-desc" :title =" props.desc" >{{ props.desc }}</div >
16
18
</div >
17
19
</div >
18
- <div class =" proj-card-badges" >
20
+ <div v-if =" props.import" class =" proj-card-badge-box" >
21
+ <div class =" proj-card-badge-title" >{{ getImportTitle() }}</div >
22
+ <div class =" proj-card-badges" >
23
+ <slot name =" import" ></slot >
24
+ </div >
25
+ </div >
26
+ <div v-if =" props.export" class =" proj-card-badge-box" >
27
+ <div class =" proj-card-badge-title" >{{ getExportTitle() }}</div >
28
+ <div class =" proj-card-badges" >
29
+ <slot name =" export" ></slot >
30
+ </div >
31
+ </div >
32
+ <div class =" proj-card-badges" v-if =" !props.export && !props.import" >
19
33
<slot ></slot >
20
34
</div >
21
35
</div >
22
36
</div >
23
37
</template >
24
38
<script lang="ts" setup>
25
- import { computed } from " vue" ;
39
+ import { computed , onMounted , ref } from " vue" ;
26
40
import { useLocalStorage } from " @vueuse/core" ;
27
41
28
42
interface ProjCardDevProps {
@@ -32,9 +46,25 @@ interface ProjCardDevProps {
32
46
desc: string ;
33
47
repo? : string ;
34
48
site? : string ;
49
+ import? : true ;
50
+ export? : true ;
35
51
}
36
52
37
53
const props = defineProps <ProjCardDevProps >();
54
+ const lang = ref (" zh-CN" );
55
+
56
+ onMounted (() => {
57
+ const path = window .location .pathname ;
58
+ lang .value = path .startsWith (" /zh/" ) ? " zh-CN" : " en-US" ;
59
+ });
60
+
61
+ function getImportTitle() {
62
+ return lang .value === " zh-CN" ? " 导入支持:" : " Supported Import:" ;
63
+ }
64
+
65
+ function getExportTitle() {
66
+ return lang .value === " zh-CN" ? " 导出支持:" : " Supported Export:" ;
67
+ }
38
68
39
69
function isDarkTheme(): boolean | null {
40
70
const theme = useLocalStorage <" auto" | " dark" | " light" >(" vuepress-theme-hope-scheme" , " auto" );
@@ -62,6 +92,10 @@ function toRepo() {
62
92
function toSite() {
63
93
window .open (props .site , " _blank" );
64
94
}
95
+
96
+ function toProj() {
97
+ window .open (props .site || props .repo , " _blank" );
98
+ }
65
99
</script >
66
100
<style lang="css" scoped>
67
101
.proj-card-dev {
@@ -74,6 +108,7 @@ function toSite() {
74
108
display : flex ;
75
109
flex-direction : column ;
76
110
background : v-bind(contentBg);
111
+ margin-bottom : 1.2em ;
77
112
}
78
113
79
114
.proj-card-bg {
@@ -114,7 +149,7 @@ function toSite() {
114
149
}
115
150
116
151
i :hover {
117
- color : var (--theme-color )
152
+ color : var (--theme-color );
118
153
}
119
154
}
120
155
@@ -154,6 +189,20 @@ function toSite() {
154
189
.proj-card-title {
155
190
font-size : 1.5em ;
156
191
font-weight : bold ;
192
+ cursor : pointer ;
193
+ }
194
+
195
+ .proj-card-badge-box {
196
+ display : flex ;
197
+ flex-direction : column ;
198
+ align-items : flex-start ;
199
+ justify-content : flex-start ;
200
+ gap : 0.5em ;
201
+ }
202
+
203
+ .proj-card-badge-title {
204
+ font-size : 1.2em ;
205
+ font-weight : bold ;
157
206
}
158
207
159
208
.proj-card-badges {
0 commit comments