fix(components): [notification] custom icon not work (#9498)

This commit is contained in:
zz 2022-08-28 13:47:30 +08:00 committed by GitHub
parent fc7343be83
commit ba15302200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -39,7 +39,7 @@ describe('Notification.vue', () => {
expect(wrapper.text()).toEqual(AXIOM)
expect(vm.visible).toBe(true)
expect(vm.iconComponent).toBe('')
expect(vm.iconComponent).toBeUndefined()
expect(vm.horizontalClass).toBe('right')
expect(vm.positionStyle).toEqual({
top: '0px',

View File

@ -1,4 +1,4 @@
import { buildProps, definePropType } from '@element-plus/utils'
import { buildProps, definePropType, iconPropType } from '@element-plus/utils'
import type { ExtractPropTypes, VNode } from 'vue'
import type Notification from './notification.vue'
@ -24,8 +24,7 @@ export const notificationProps = buildProps({
default: 4500,
},
icon: {
type: definePropType<string | Comment>([String, Object]),
default: '',
type: iconPropType,
},
id: {
type: String,

View File

@ -67,7 +67,7 @@ const typeClass = computed(() => {
})
const iconComponent = computed(() => {
if (!props.type) return ''
if (!props.type) return props.icon
return TypeComponentsMap[props.type] || props.icon
})