修复VFormRender组件用@声明事件处理失效的问题。

This commit is contained in:
vdpAdmin 2022-04-08 11:28:06 +08:00
parent af06777daf
commit 8cdafa4136
2 changed files with 8 additions and 6 deletions

View File

@ -349,16 +349,16 @@
* 获取所有字段组件 * 获取所有字段组件
* @returns {*[]} * @returns {*[]}
*/ */
getFieldWidgets() { getFieldWidgets(widgetList = null) {
return getAllFieldWidgets(this.designer.widgetList) return !!widgetList ? getAllFieldWidgets(widgetList) : getAllFieldWidgets(this.designer.widgetList)
}, },
/** /**
* 获取所有容器组件 * 获取所有容器组件
* @returns {*[]} * @returns {*[]}
*/ */
getContainerWidgets() { getContainerWidgets(widgetList = null) {
return getAllContainerWidgets(this.designer.widgetList) return !!widgetList ? getAllContainerWidgets(widgetList) : getAllContainerWidgets(this.designer.widgetList)
}, },
//TODO: //TODO:

View File

@ -51,7 +51,6 @@ export default {
}, },
dispatch: function dispatch(componentName, eventName, params) { dispatch: function dispatch(componentName, eventName, params) {
//debugger
let parent = this.$parent || this.$root; let parent = this.$parent || this.$root;
let name = parent.$options.componentName; let name = parent.$options.componentName;
@ -63,9 +62,12 @@ export default {
} }
} }
if (parent) { if (parent) {
//parent.$emit.apply(parent, [eventName].concat(params));
if (!!parent.emit$) { if (!!parent.emit$) {
parent.emit$.call(parent, eventName, params) parent.emit$.call(parent, eventName, params)
if (componentName === 'VFormRender') {
parent.$emit(eventName, params) //执行原生$emit以便可以用@进行声明式事件处理!!
}
} }
} }
}, },