refactor(front): update file handling in FileUpload components to improve data consistency and maintainability

This commit is contained in:
keven1024
2025-05-02 19:13:19 +08:00
parent 610da371bc
commit 981aab4721
2 changed files with 4 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ const renderComponent = computed(() => {
})
</script>
<template>
<VeeForm v-slot="{ values }">
<VeeForm v-slot="{ values }" :keepValues="true">
<div class="rounded-xl p-5 bg-white/50 backdrop-blur-xl w-full lg:w-200">
<component :is="renderComponent" :data="values" @change="(key: string) => {
step = key

View File

@@ -10,12 +10,11 @@ const emit = defineEmits<{
}>()
const handleFormSubmit = (form: any) => {
const { _file } = form?.values || {}
const { file } = form?.values || {}
showDrawer({
render: ({ hide }) => h(FileShareDrawer, {
hide, file: _file, onFileHandle: ({ type, config }) => {
hide, file, onFileHandle: ({ type, config }) => {
form.setFieldValue('file_handle_type', type)
form.setFieldValue('file', _file)
form.setFieldValue('config', config)
emit('change', 'progress')
}
@@ -28,7 +27,7 @@ const handleFormSubmit = (form: any) => {
<template>
<div class="gap-5 flex flex-col">
<div class="text-xl font-normal">上传文件</div>
<FileUploadField name="_file" rules="required" />
<FileUploadField name="file" rules="required" />
<div class="flex flex-row gap-3">
<FormButton @click="handleFormSubmit">
<LucideShare class="size-4" />提交