diff --git a/src/components/form-designer/index.vue b/src/components/form-designer/index.vue index 50aed0b..1ef0274 100644 --- a/src/components/form-designer/index.vue +++ b/src/components/form-designer/index.vue @@ -349,16 +349,16 @@ * 获取所有字段组件 * @returns {*[]} */ - getFieldWidgets() { - return getAllFieldWidgets(this.designer.widgetList) + getFieldWidgets(widgetList = null) { + return !!widgetList ? getAllFieldWidgets(widgetList) : getAllFieldWidgets(this.designer.widgetList) }, /** * 获取所有容器组件 * @returns {*[]} */ - getContainerWidgets() { - return getAllContainerWidgets(this.designer.widgetList) + getContainerWidgets(widgetList = null) { + return !!widgetList ? getAllContainerWidgets(widgetList) : getAllContainerWidgets(this.designer.widgetList) }, //TODO: 增加更多方法!! diff --git a/src/utils/emitter.js b/src/utils/emitter.js index 21b1822..5277b44 100644 --- a/src/utils/emitter.js +++ b/src/utils/emitter.js @@ -51,7 +51,6 @@ export default { }, dispatch: function dispatch(componentName, eventName, params) { - //debugger let parent = this.$parent || this.$root; let name = parent.$options.componentName; @@ -63,9 +62,12 @@ export default { } } if (parent) { - //parent.$emit.apply(parent, [eventName].concat(params)); if (!!parent.emit$) { parent.emit$.call(parent, eventName, params) + + if (componentName === 'VFormRender') { + parent.$emit(eventName, params) //执行原生$emit,以便可以用@进行声明式事件处理!! + } } } },