interface.ts 758 B

12345678910111213141516171819202122232425262728
  1. import type { ExtractPropTypes, PropType } from 'vue'
  2. export function stringType<T extends string = string>(defaultVal?: T) {
  3. return { type: String as unknown as PropType<T | string>, default: defaultVal as T }
  4. }
  5. export function booleanType(defaultVal?: boolean) {
  6. return { type: Boolean, default: defaultVal as boolean }
  7. }
  8. export type FileType = 'word' | 'excel' | 'pdf' | 'txt'
  9. export const previewOfficeProps = () => {
  10. return {
  11. value: stringType(''),
  12. name: stringType(''),
  13. type: stringType<FileType>('word'),
  14. zIndex: {
  15. type: Number,
  16. default: 990
  17. },
  18. /** 点击遮罩是否关闭 默认true */
  19. closeOnClickModal: booleanType(true)
  20. }
  21. }
  22. export type UploadFileProps = ExtractPropTypes<ReturnType<typeof previewOfficeProps>>