25
25
<el-form-item
26
26
v-for =" (item, index) in configList"
27
27
:key =" item.name + index"
28
- :label =" item.alias || item.name"
29
28
:required =" item.required"
30
29
:prop =" item.name"
31
30
>
31
+ <template #label >
32
+ <el-row align =" middle" >
33
+ {{ item.alias || item.name }}
34
+ <template v-if =" item .tips " >
35
+ <el-tooltip
36
+ class =" item"
37
+ effect =" dark"
38
+ placement =" right"
39
+ >
40
+ <template #content >
41
+ <span
42
+ class =" config-form-common-tips"
43
+ v-html =" transformMarkdownToHTML(item.tips)"
44
+ />
45
+ </template >
46
+ <el-icon class =" ml-[4px] cursor-pointer hover:text-blue" >
47
+ <QuestionFilled />
48
+ </el-icon >
49
+ </el-tooltip >
50
+ </template >
51
+ </el-row >
52
+ </template >
32
53
<el-input
33
54
v-if =" item.type === 'input' || item.type === 'password'"
34
55
v-model =" ruleForm[item.name]"
67
88
:active-text =" item.confirmText || 'yes'"
68
89
:inactive-text =" item.cancelText || 'no'"
69
90
/>
70
- <div v-if =" item.tips" class =" common-tips" @mouseenter =" () => isHoverTips = true" @mouseleave =" () => isHoverTips = false" >
71
- <el-tooltip
72
- :content =" item.tips"
73
- placement =" top"
74
- raw-content
75
- effect =" light"
76
- >
77
- <el-button v-if =" isHoverTips" type =" primary" :icon =" Warning" circle />
78
- <el-button v-if =" !isHoverTips" type =" info" :icon =" Warning" circle />
79
- </el-tooltip >
80
- </div >
81
91
</el-form-item >
82
92
<slot />
83
93
</el-form >
@@ -89,7 +99,8 @@ import { cloneDeep, union } from 'lodash'
89
99
import { getConfig } from ' @/utils/dataSender'
90
100
import { useRoute } from ' vue-router'
91
101
import type { FormInstance } from ' element-plus'
92
- import { Warning } from ' @element-plus/icons-vue'
102
+ import { QuestionFilled } from ' @element-plus/icons-vue'
103
+ import { marked } from ' marked'
93
104
94
105
interface IProps {
95
106
config: any []
@@ -101,7 +112,6 @@ interface IProps {
101
112
const props = defineProps <IProps >()
102
113
const $route = useRoute ()
103
114
const $form = ref <FormInstance >()
104
- const isHoverTips = ref (false )
105
115
const configList = ref <IPicGoPluginConfig []>([])
106
116
const ruleForm = reactive <IStringKeyMap >({})
107
117
@@ -145,6 +155,14 @@ function getConfigType () {
145
155
}
146
156
}
147
157
158
+ function transformMarkdownToHTML (markdown : string ) {
159
+ try {
160
+ return marked .parse (markdown )
161
+ } catch (e ) {
162
+ return markdown
163
+ }
164
+ }
165
+
148
166
async function handleConfig (val : IPicGoPluginConfig []) {
149
167
const config = await getCurConfigFormData ()
150
168
const configId = $route .params .configId
@@ -184,6 +202,10 @@ defineExpose({
184
202
})
185
203
</script >
186
204
<style lang='stylus'>
205
+ .config-form-common-tips
206
+ a
207
+ color #40 9E FF
208
+ text-decoration none
187
209
#config-form
188
210
.el-form
189
211
label
@@ -210,7 +232,4 @@ defineExpose({
210
232
& .white
211
233
.el-form-item
212
234
border-bottom 1px solid #d d d
213
- .common-tips
214
- margin-left 10px
215
- display inline-block
216
235
</style >
0 commit comments