From 6f25f6ecd4c6bd9260f37b27fb9df4c6deed2f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Wed, 19 Jan 2022 10:26:31 +0800 Subject: [PATCH] refactor(components): [alert] add namespace & instance type (#5459) --- packages/components/alert/src/alert.ts | 7 +++++-- packages/components/alert/src/alert.vue | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/components/alert/src/alert.ts b/packages/components/alert/src/alert.ts index f067b75c88..1be6b82c51 100644 --- a/packages/components/alert/src/alert.ts +++ b/packages/components/alert/src/alert.ts @@ -1,8 +1,9 @@ import { TypeComponentsMap } from '@element-plus/utils/icon' import { buildProps, keyOf } from '@element-plus/utils/props' import type { ExtractPropTypes } from 'vue' +import type Alert from './alert.vue' -export type AlertEffect = 'light' | 'dark' +export const alertEffects = ['light', 'dark'] as const export const alertProps = buildProps({ title: { @@ -30,7 +31,7 @@ export const alertProps = buildProps({ center: Boolean, effect: { type: String, - values: ['light', 'dark'], + values: alertEffects, default: 'light', }, } as const) @@ -40,3 +41,5 @@ export const alertEmits = { close: (evt: MouseEvent) => evt instanceof MouseEvent, } export type AlertEmits = typeof alertEmits + +export type AlertInstance = InstanceType diff --git a/packages/components/alert/src/alert.vue b/packages/components/alert/src/alert.vue index fbb103f287..c176456525 100644 --- a/packages/components/alert/src/alert.vue +++ b/packages/components/alert/src/alert.vue @@ -2,26 +2,23 @@