add:增加编辑、删除等功能

This commit is contained in:
zlong committed 2024-11-21 17:39:36 +08:00
1 parent b3ae608daa
commit b4541b6f78
5 files changed
+171 -91

No files matched your search

+22 -1
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { MessagePlugin, type UploadProps } from 'tdesign-vue-next'
import {ref} from 'vue'
import { ref, watch } from 'vue'
import { useAppStore } from '@/stores/app'
const imageViewerProps = ref<UploadProps['imageViewerProps']>({
closeOnEscKeydown: false,
@@ -19,6 +19,7 @@ const handleFail: UploadProps['onFail'] = ({ file }) => {
};
const handleSuccess: UploadProps['onSuccess'] = ({ file }) => {
if(file?.url){
console.log(file1.value,'file1')
emits('on-success',file.url)
}
}
@@ -27,7 +28,27 @@ const appStore = useAppStore()
const uploadHeaders = ref<UploadProps['headers']>({
Authorization: `Bearer ${appStore.token}`
})
const props = defineProps({
imageUrl:{
type:Object,
default:() => {
return { url: '' }
}
}
})
const emits = defineEmits(['on-success'])
watch(() => props.imageUrl,(newVal) => {
if(newVal){
if(newVal.url !== ''){
file1.value = [{ ...newVal }]
}else{
file1.value = []
}
}
},{
deep:true,
immediate:true
})
</script>
<template>