CzRger 1 年之前
父節點
當前提交
807f19fce2
共有 2 個文件被更改,包括 3 次插入8 次删除
  1. 1 0
      src/components/cus/CusForm.vue
  2. 2 8
      src/components/cus/CusFormColumn.vue

+ 1 - 0
src/components/cus/CusForm.vue

@@ -71,6 +71,7 @@ export default defineComponent({
     const handleEnter = () => {
       emit('handleEnter')
     }
+    provide('handle-enter', handleEnter)
     const reset = () => {
       state.formChildren.forEach((v: any) => {
         v.reset()

+ 2 - 8
src/components/cus/CusFormColumn.vue

@@ -339,15 +339,9 @@ export default defineComponent({
       }
       return state.errorMessage
     }
+    const handleEnterFunc = inject('handle-enter', () => {})
     const handleEnter = () => {
-      const find = (itemVue: any) => {
-        if (itemVue?.type.name === "CusForm") {
-          itemVue.setupState.handleEnter()
-        } else {
-          find(itemVue.parent)
-        }
-      }
-      find(ref_cusFormColumn?.value?.$el?.__vueParentComponent)
+      handleEnterFunc?.()
     }
     const reset = () => {
       state.errorMessage = null