This commit is contained in:
zhangjianjun 2026-07-10 14:46:39 +08:00
parent 3225e84cff
commit e8594ed8d4
1 changed files with 57 additions and 33 deletions

View File

@ -69,7 +69,7 @@
<script setup lang="ts">
import { ref, computed, watch, defineComponent, h, type PropType, type VNode, type Component } from 'vue'
import { Close, FullScreen, CopyDocument, Plus, Delete, UploadFilled } from '@element-plus/icons-vue'
import { Close, FullScreen, CopyDocument, Plus, Delete, Document, UploadFilled } from '@element-plus/icons-vue'
import {
ElFormItem, ElInput, ElInputNumber, ElSwitch, ElButton,
ElCollapse, ElCollapseItem, ElIcon, ElMessage,
@ -385,7 +385,8 @@ const NodeEditor: Component = defineComponent({
let uploadNode = null;
if ((isFile || isImage || isVideo)) {
uploadNode = h(UploadInput, {
uploadNode = [
h(UploadInput, {
value: [{url: value}],
type: isImage ? 'image' : isVideo ? 'video' : 'file',
uploadFile: props.uploadFile,
@ -396,7 +397,14 @@ const NodeEditor: Component = defineComponent({
p.parent[key] = v[0].url || ''
}
},
})
}),
h(ElButton, {
size: 'small', type: 'primary', link: true,
title: '切换为输入框',
'aria-label': '切换为输入框',
onClick: () => p.parent[key] = '',
}, () => h(ElIcon, { size: 14 }, () => h(Document))),
]
}
const inputNode = [
h(ElInput, {
@ -405,9 +413,10 @@ const NodeEditor: Component = defineComponent({
'onUpdate:modelValue': (v: string) => { p.parent[key] = v },
style: { width: '90%', marginRight: '5px' },
}),
p.parent[key] === '' && h(ElButton, {
size: 'small', type: 'primary',
title: '切换为图片上传框',
h(ElButton, {
size: 'small', type: 'primary', link: true,
title: '切换为上传组件',
'aria-label': '切换为上传组件',
onClick: () => p.parent[key] = '1.png',
}, () => h(ElIcon, { size: 14 }, () => h(UploadFilled))),
]
@ -423,9 +432,7 @@ const NodeEditor: Component = defineComponent({
},
})
const formItemNode = [
uploadNode || (hasHtmlClosingTag ? wangEditor : inputNode),
]
const formItemNode = uploadNode || (hasHtmlClosingTag ? [wangEditor] : inputNode)
const zhVal = p.zhParent?.[key]
@ -471,7 +478,8 @@ const NodeEditor: Component = defineComponent({
const isFile = value[i].includes('.pdf') || value[i].includes('.doc') || value[i].includes('.docx') || value[i].includes('.xls') || value[i].includes('.xlsx') || value[i].includes('.ppt') || value[i].includes('.pptx')
let uploadNode = null;
if ((isFile || isImage || isVideo)) {
uploadNode = h(UploadInput, {
uploadNode = [
h(UploadInput, {
value: [{url: value[i], name: value[i]}],
type: isImage ? 'image' : isVideo ? 'video' : 'file',
uploadFile: props.uploadFile,
@ -482,13 +490,29 @@ const NodeEditor: Component = defineComponent({
value[i] = v[0].url || ''
}
},
})
}),
h(ElButton, {
size: 'small', type: 'primary', link: true,
title: '切换为输入框',
'aria-label': '切换为输入框',
onClick: () => value[i] = '',
}, () => h(ElIcon, { size: 14 }, () => h(Document))),
]
}
return h('div', { class: 'jfd-string-item', key: i }, [
uploadNode || h(ElInput, {
const valueNode = uploadNode || [
h(ElInput, {
modelValue: value[i],
'onUpdate:modelValue': (v: string) => { value[i] = v },
}),
h(ElButton, {
size: 'small', type: 'primary', link: true,
title: '切换为上传组件',
'aria-label': '切换为上传组件',
onClick: () => value[i] = '1.png',
}, () => h(ElIcon, { size: 14 }, () => h(UploadFilled))),
]
return h('div', { class: 'jfd-string-item', key: i }, [
...valueNode,
showBtn ? h(ElButton, {
link: true, size: 'small', class: 'jfd-translate-icon',
loading: translatingPath.value === `${key}-${i}`,