chore: 优化上传组件

This commit is contained in:
AN
2025-04-27 21:14:44 +08:00
parent 63b49f1d40
commit 318abe92cf
2 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, useAttrs } from 'vue';
import { ref, useAttrs, watch } from 'vue';
import type { UploadFileInfo, UploadProps } from 'naive-ui';
import { fetchBatchDeleteOss } from '@/service/api/system/oss';
import { getToken } from '@/store/modules/auth/shared';
@ -31,6 +31,16 @@ const attrs: UploadProps = useAttrs();
let fileNum = 0;
const fileList = ref<UploadFileInfo[]>([]);
const needRelaodData = defineModel<boolean>('needRelaodData', {
default: false
});
watch(
() => fileList.value,
newValue => {
needRelaodData.value = newValue.length > 0;
}
);
const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
const { baseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);