mirror of
https://github.com/keven1024/015.git
synced 2026-06-04 03:19:35 +00:00
feat(front): add TextUploadView and FileUpload components for enhanced file and text sharing functionality
This commit is contained in:
37
front/components/Home/File/FileUploadInputFileView.vue
Normal file
37
front/components/Home/File/FileUploadInputFileView.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<script lang="ts" setup>
|
||||
import showDrawer from '~/lib/showDrawer'
|
||||
import FileShareDrawer from '@/components/Drawer/FileShareDrawer.vue'
|
||||
import FileUploadField from '@/components/Field/FileUploadField.vue'
|
||||
import FormButton from '@/components/Field/FormButton.vue'
|
||||
// const form = useFormContext()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change', key: string): void
|
||||
}>()
|
||||
|
||||
const handleFormSubmit = async (form: any) => {
|
||||
const { file } = form?.values || {}
|
||||
showDrawer({
|
||||
render: ({ hide }) => h(FileShareDrawer, {
|
||||
hide, file, onFileHandle: ({ type, config }) => {
|
||||
form.setFieldValue('file_handle_type', type)
|
||||
form.setFieldValue('config', config)
|
||||
emit('change', 'progress')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="gap-5 flex flex-col">
|
||||
<div class="text-xl font-normal">上传文件</div>
|
||||
<FileUploadField name="file" rules="required" />
|
||||
<div class="flex flex-row gap-3">
|
||||
<FormButton @click="handleFormSubmit">
|
||||
<LucideShare class="size-4" />提交
|
||||
</FormButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user