1+ <template >
2+ <ShadcnModal v-model =" visible"
3+ width =" 50%"
4+ height =" 60%"
5+ :title =" title"
6+ @on-close =" onCancel" >
7+ <div v-if =" info" class =" relative w-full h-full flex flex-col items-center p-6" >
8+ <div class =" flex flex-col items-center mb-6" >
9+ <ShadcnAvatar class =" mb-4 shadow-lg border-4 border-gray-100"
10+ style =" width : 5rem ; height : 5rem ;"
11+ :src =" info.logo || '/static/images/plugin.png'"
12+ :alt =" info.label" >
13+ </ShadcnAvatar >
14+
15+ <h3 class =" text-xl font-semibold text-gray-800 mb-2" >{{ info.label }}</h3 >
16+ </div >
17+
18+ <div class =" w-full max-w-md mb-6" >
19+ <div class =" bg-gray-50 rounded-lg p-4 text-center" >
20+ <ShadcnText class =" text-sm text-gray-600 leading-relaxed" type =" small" >
21+ {{ info.i18nFormat ? $t(info.description) : info.description }}
22+ </ShadcnText >
23+ </div >
24+ </div >
25+
26+ <div class =" w-full max-w-md space-y-4" >
27+ <div class =" flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200" >
28+ <span class =" text-sm font-medium text-gray-700" >{{ $t('common.plugin.version') }}</span >
29+ <ShadcnTag >{{ info.version }}</ShadcnTag >
30+ </div >
31+
32+ <div v-if =" info.installed" class =" flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200" >
33+ <span class =" text-sm font-medium text-gray-700" >{{ $t('common.installVersion') }}</span >
34+ <ShadcnTag color =" #00BFFF" >{{ info.installVersion }}</ShadcnTag >
35+ </div >
36+
37+ <div class =" flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200" >
38+ <span class =" text-sm font-medium text-gray-700" >{{ $t('common.author') }}</span >
39+ <span class =" text-sm text-gray-600" >{{ info.author }}</span >
40+ </div >
41+
42+ <div class =" flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200" >
43+ <span class =" text-sm font-medium text-gray-700" >{{ $t('common.releasedTime') }}</span >
44+ <span class =" text-sm text-gray-600" >{{ info.released }}</span >
45+ </div >
46+
47+ <div class =" p-3 bg-white rounded-lg border border-gray-200" style =" margin-bottom : 1rem ;" >
48+ <div class =" flex items-center justify-between mb-2" >
49+ <span class =" text-sm font-medium text-gray-700" >{{ $t('common.plugin.list.supportVersion') }}</span >
50+ </div >
51+
52+ <div class =" flex flex-wrap gap-2" >
53+ <ShadcnTag v-for =" version in info.supportVersion" type =" success" :key =" version" >
54+ {{ version }}
55+ </ShadcnTag >
56+ </div >
57+ </div >
58+ </div >
59+ </div >
60+
61+ <template #footer >
62+ <ShadcnButton type =" default" @click =" onCancel" >
63+ {{ $t('common.cancel') }}
64+ </ShadcnButton >
65+ </template >
66+ </ShadcnModal >
67+ </template >
68+
69+ <script setup lang="ts">
70+ import { computed , onMounted , ref , watch } from ' vue'
71+ import { useI18n } from ' vue-i18n'
72+
73+ interface Props
74+ {
75+ isVisible: boolean
76+ info: any | null
77+ }
78+
79+ interface Emits
80+ {
81+ (e : ' close' , value : boolean ): void
82+ }
83+
84+ const props = withDefaults (defineProps <Props >(), {
85+ isVisible: false ,
86+ info: null
87+ })
88+ const emit = defineEmits <Emits >()
89+ const { t } = useI18n ()
90+
91+ const title = ref <string | null >(null )
92+
93+ const visible = computed ({
94+ get(): boolean
95+ {
96+ return props .isVisible
97+ },
98+ set(value : boolean )
99+ {
100+ emit (' close' , value )
101+ }
102+ })
103+
104+ const handleInitialize = () => {
105+ if (props .info ) {
106+ title .value = props .info .label
107+ }
108+ }
109+
110+ const onCancel = () => {
111+ visible .value = false
112+ emit (' close' , false )
113+ }
114+
115+ onMounted (() => {
116+ handleInitialize ()
117+ })
118+
119+ watch (() => props .info , () => {
120+ handleInitialize ()
121+ }, { immediate: true })
122+ </script >
0 commit comments