Files
Jeremy 8ccb7df2df docs(components): [alert] (#10373)
* docs(components): [alert]

* Update alert doc.
* Add comment for alert props.
* Reorganize code.
2022-11-03 20:38:41 +08:00

60 lines
1.1 KiB
TypeScript

import { TypeComponentsMap, buildProps, keysOf } from '@element-plus/utils'
import type { ExtractPropTypes } from 'vue'
export const alertEffects = ['light', 'dark'] as const
export const alertProps = buildProps({
/**
* @description alert title.
*/
title: {
type: String,
default: '',
},
description: {
type: String,
default: '',
},
/**
* @description alert type.
*/
type: {
type: String,
values: keysOf(TypeComponentsMap),
default: 'info',
},
/**
* @description whether alert can be dismissed.
*/
closable: {
type: Boolean,
default: true,
},
/**
* @description text for replacing x button
*/
closeText: {
type: String,
default: '',
},
/**
* @description whether show icon
*/
showIcon: Boolean,
/**
* @description should content be placed in center.
*/
center: Boolean,
effect: {
type: String,
values: alertEffects,
default: 'light',
},
} as const)
export type AlertProps = ExtractPropTypes<typeof alertProps>
export const alertEmits = {
close: (evt: MouseEvent) => evt instanceof MouseEvent,
}
export type AlertEmits = typeof alertEmits