From 0e8d4f4230e40e5e5f431a7246cac38984b2c381 Mon Sep 17 00:00:00 2001 From: BeADre Date: Fri, 15 Oct 2021 10:03:40 +0800 Subject: [PATCH] fix(snackbar/types): fix types of related loading props --- packages/varlet-ui/src/loading/props.ts | 4 ++-- packages/varlet-ui/src/snackbar/index.tsx | 7 ++++--- packages/varlet-ui/types/snackbar.d.ts | 8 ++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/varlet-ui/src/loading/props.ts b/packages/varlet-ui/src/loading/props.ts index 71a07a46adc..148514f2e56 100644 --- a/packages/varlet-ui/src/loading/props.ts +++ b/packages/varlet-ui/src/loading/props.ts @@ -1,8 +1,8 @@ import type { PropType } from 'vue' -type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear' +export type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear' -type LoadingSize = 'normal' | 'mini' | 'small' | 'large' +export type LoadingSize = 'normal' | 'mini' | 'small' | 'large' export function typeValidator(type: string): boolean { return ['circle', 'wave', 'cube', 'rect', 'disappear'].includes(type) diff --git a/packages/varlet-ui/src/snackbar/index.tsx b/packages/varlet-ui/src/snackbar/index.tsx index bf804d0c195..9c818782126 100644 --- a/packages/varlet-ui/src/snackbar/index.tsx +++ b/packages/varlet-ui/src/snackbar/index.tsx @@ -1,8 +1,9 @@ import type { App, Component } from 'vue' +import { reactive, TransitionGroup } from 'vue' import VarSnackbarCore from './core.vue' import VarSnackbar from './Snackbar.vue' import context from '../context' -import { reactive, TransitionGroup } from 'vue' +import type { LoadingType, LoadingSize } from '../loading/props' import { mountInstance } from '../utils/components' import { isPlainObject, toNumber } from '../utils/shared' @@ -18,8 +19,8 @@ interface SnackbarOptions { type?: SnackbarType content?: string position?: 'top' | 'center' | 'bottom' - loadingType?: string - loadingSize?: string + loadingType?: LoadingType + loadingSize?: LoadingSize teleport?: string lockScroll?: boolean contentClass?: string diff --git a/packages/varlet-ui/types/snackbar.d.ts b/packages/varlet-ui/types/snackbar.d.ts index f9622c64dfa..0ac3c178a62 100644 --- a/packages/varlet-ui/types/snackbar.d.ts +++ b/packages/varlet-ui/types/snackbar.d.ts @@ -1,12 +1,16 @@ import type { App } from 'vue' import { VarComponent } from './varComponent' +export type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear' + +export type LoadingSize = 'normal' | 'mini' | 'small' | 'large' + export interface SnackbarProps { type?: SnackbarType content?: string position?: 'top' | 'center' | 'bottom' - loadingType?: string - loadingSize?: string + loadingType?: LoadingType + loadingSize?: LoadingSize teleport?: string lockScroll?: boolean contentClass?: string