From 821b35882ad555dc70800acb14897a3947edfb88 Mon Sep 17 00:00:00 2001 From: lumdzeehol Date: Mon, 23 Oct 2023 15:09:18 +0800 Subject: [PATCH] fix: #3986 --- .../element/src/__builtins__/shared/transform-component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/element/src/__builtins__/shared/transform-component.ts b/packages/element/src/__builtins__/shared/transform-component.ts index 2aef0ce0db5..6f06537ea7f 100644 --- a/packages/element/src/__builtins__/shared/transform-component.ts +++ b/packages/element/src/__builtins__/shared/transform-component.ts @@ -4,6 +4,7 @@ import { h } from '@formily/vue' import { isVue2, defineComponent } from 'vue-demi' type ListenersTransformRules = Record +const noop = () => {} export const transformComponent = >( tag: any, @@ -27,7 +28,7 @@ export const transformComponent = >( 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 } }) } @@ -51,7 +52,7 @@ export const transformComponent = >( 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) {