获取焦点时防止滑动返回抖动

This commit is contained in:
kuaifan 2022-06-02 08:45:03 +08:00
parent b4453cacc0
commit a1b6dc9e84
2 changed files with 22 additions and 4 deletions

View File

@ -168,6 +168,9 @@
:size="380"> :size="380">
<DialogGroupInfo v-if="groupInfoShow" :dialogId="dialogId"/> <DialogGroupInfo v-if="groupInfoShow" :dialogId="dialogId"/>
</DrawerOverlay> </DrawerOverlay>
<!--滑动拦截-->
<div ref="back" v-show="isFocus" class="dialog-wrapper-back"></div>
</div> </div>
</template> </template>
@ -208,6 +211,7 @@ export default {
msgText: '', msgText: '',
msgNew: 0, msgNew: 0,
topId: 0, topId: 0,
isFocus: false,
allMsgs: [], allMsgs: [],
tempMsgs: [], tempMsgs: [],
@ -228,11 +232,11 @@ export default {
}, },
mounted() { mounted() {
this.$refs.back.addEventListener('touchmove', this.backListener)
}, },
beforeDestroy() { beforeDestroy() {
this.$refs.back.removeEventListener('touchmove', this.backListener)
}, },
computed: { computed: {
@ -584,10 +588,12 @@ export default {
}, },
onEventFocus() { onEventFocus() {
this.isFocus = true;
this.$emit("on-focus") this.$emit("on-focus")
}, },
onEventBlur() { onEventBlur() {
this.isFocus = false;
this.$emit("on-blur") this.$emit("on-blur")
}, },
@ -704,7 +710,11 @@ export default {
} else { } else {
this.goBack(); this.goBack();
} }
} },
backListener(e) {
e.preventDefault()
},
} }
} }
</script> </script>

View File

@ -934,7 +934,6 @@
} }
} }
.dialog-wrapper-paste { .dialog-wrapper-paste {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -966,6 +965,15 @@
} }
} }
.dialog-wrapper-back {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 20px;
z-index: 9998;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.dialog-wrapper { .dialog-wrapper {
.dialog-nav { .dialog-nav {