refactor(components): [el-result] improve props

This commit is contained in:
Kevin 2021-11-06 02:43:15 +08:00 committed by 三咲智子
parent c10d0cbab3
commit 03b86d69b4

View File

@ -5,17 +5,19 @@ import {
CircleCloseFilled,
InfoFilled,
} from '@element-plus/icons'
import type { Indexable } from '@element-plus/utils/types'
import type { Component, ExtractPropTypes } from 'vue'
export const IconMap: Indexable<string> = {
export const IconMap = {
success: 'icon-success',
warning: 'icon-warning',
error: 'icon-error',
info: 'icon-info',
}
} as const
export const IconComponentMap: Indexable<Component> = {
export const IconComponentMap: Record<
typeof IconMap[keyof typeof IconMap],
Component
> = {
[IconMap.success]: CircleCheckFilled,
[IconMap.warning]: WarningFilled,
[IconMap.error]: CircleCloseFilled,
@ -32,7 +34,7 @@ export const resultProps = buildProps({
default: '',
},
icon: {
type: String,
values: ['success', 'warning', 'info', 'error'],
default: 'info',
},
} as const)