Skip to content

Commit

Permalink
fix(components): [notification] custom icon not work (#9498)
Browse files Browse the repository at this point in the history
  • Loading branch information
holazz committed Aug 28, 2022
1 parent fc7343b commit ba15302
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions packages/components/notification/src/notification.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -24,8 +24,7 @@ export const notificationProps = buildProps({
default: 4500,
},
icon: {
type: definePropType<string | Comment>([String, Object]),
default: '',
type: iconPropType,
},
id: {
type: String,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/notification/src/notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit ba15302

Please sign in to comment.