Skip to content

Commit

Permalink
fix: #3986
Browse files Browse the repository at this point in the history
  • Loading branch information
lumdzeehol committed Oct 23, 2023
1 parent d8716ea commit 821b358
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { h } from '@formily/vue'
import { isVue2, defineComponent } from 'vue-demi'

type ListenersTransformRules = Record<string, string>
const noop = () => {}

export const transformComponent = <T extends Record<string, any>>(
tag: any,
Expand All @@ -27,7 +28,7 @@ export const transformComponent = <T extends Record<string, any>>(
const transformListeners = transformRules
Object.keys(transformListeners).forEach((extract) => {
if (data.on !== undefined) {
data.on[transformListeners[extract]] = listeners[extract]
data.on[transformListeners[extract]] = listeners[extract] || noop
}
})
}
Expand All @@ -51,7 +52,7 @@ export const transformComponent = <T extends Record<string, any>>(
Object.keys(listeners).forEach((extract) => {
const event = listeners[extract]
data[`on${event[0].toUpperCase()}${event.slice(1)}`] =
attrs[`on${extract[0].toUpperCase()}${extract.slice(1)}`]
attrs[`on${extract[0].toUpperCase()}${extract.slice(1)}`] || noop
})
}
if (defaultProps) {
Expand Down

0 comments on commit 821b358

Please sign in to comment.