ZaiZai před 1 rokem
rodič
revize
fb925e76fd

+ 10 - 2
src/components/table-form/components.vue

@@ -50,7 +50,11 @@ const matchingType = () => {
 const isClick = ref(false)
 const leftTap = () => {
     isClick.value = true
-    window.postMessage({ key: 'focus', data: { ...props } })
+    window.postMessage({
+        type: 'table-form',
+        key: 'focus',
+        data: { ...props },
+    })
     emit('focus', props)
 }
 
@@ -63,7 +67,11 @@ const onClickOutside = () => {
 //失去焦点
 const onClickBlur = async () => {
     await useClick()
-    window.postMessage({ key: 'blur', data: { ...props } })
+    window.postMessage({
+        type: 'table-form',
+        key: 'blur',
+        data: { ...props },
+    })
     emit('blur', props)
 }
 

+ 1 - 0
src/components/table-form/table-form.vue

@@ -57,6 +57,7 @@ watch(() => props.form, (val) => {
 //注册监听事件
 const setEmitterData = () => {
     window.addEventListener('message', ({ data }) => {
+        if (data.type !== 'table-form') return
         console.log(data)
     })
 }