admin-vben5/apps/web-antd/src/views/演示使用自行删除/upload/hook.ts

33 lines
709 B
TypeScript
Raw Normal View History

2025-03-30 18:23:37 +08:00
import { ref } from 'vue';
export function useImageType() {
const imageListTypes = ['text', 'picture', 'picture-card'] as const;
const imageListOptions = imageListTypes.map((str) => ({
label: str,
value: str,
}));
const currentImageListType =
ref<(typeof imageListTypes)[number]>('picture-card');
return {
imageListOptions,
currentImageListType,
};
}
export function useFileType() {
const fileListTypes = ['text', 'picture'] as const;
const fileListOptions = fileListTypes.map((str) => ({
label: str,
value: str,
}));
const currentFileListType = ref<(typeof fileListTypes)[number]>('text');
return {
fileListOptions,
currentFileListType,
};
}