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

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

View File

@ -934,7 +934,6 @@
}
}
.dialog-wrapper-paste {
display: flex;
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) {
.dialog-wrapper {
.dialog-nav {