admin-vben5/apps/web-antd/src/views/演示使用自行删除/upload/hook.ts
2025-03-31 10:26:06 +08:00

33 lines
712 B
TypeScript

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]>('picture');
return {
fileListOptions,
currentFileListType,
};
}