CzRger 1 yıl önce
ebeveyn
işleme
807f19fce2

+ 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