【更新】文件上传组件与预览组件更新

pull/219/MERGE
俞宝山 2024-06-05 16:09:00 +08:00
parent 06f60f7343
commit 41d4f9c506
2 changed files with 42 additions and 13 deletions

View File

@ -78,13 +78,17 @@
const fileType = ref()
watch(
() => props.src,
() => {
(newVal) => {
if (newVal) {
fileType.value = props.fileType.toLowerCase()
}
},
{ immediate: true, deep: true }
)
watch(
() => props.src,
() => {
(newVal) => {
if (newVal) {
if (
fileType.value === 'doc' ||
fileType.value === 'docx' ||
@ -95,6 +99,8 @@
loading.value = true
}
}
},
{ immediate: true, deep: true }
)
//
const renderedHandler = () => {

View File

@ -333,4 +333,27 @@
emit('update:value', undefined)
emit('onChange', undefined)
}
// DOM
const uploadFileList = () => {
if (fileList.value) {
const result = []
//
fileList.value.forEach((item) => {
const obj = {
name: item.name,
type: item.type,
size: item.size,
url: item.response.data
}
result.push(obj)
})
return result
} else {
return []
}
}
//
defineExpose({
uploadFileList
})
</script>