mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
优化返回手势抖动问题
This commit is contained in:
parent
b4c8a45bbf
commit
b855312cf9
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="show" class="mobile-back" :style="style"></div>
|
<div class="mobile-back">
|
||||||
|
<div v-show="windowScrollY > 0" ref="bar" class="back-bar"></div>
|
||||||
|
<div v-if="show" class="back-semicircle" :style="style"></div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -27,12 +30,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.$refs.bar.addEventListener('touchmove', this.barListener)
|
||||||
document.addEventListener('touchstart', this.touchstart)
|
document.addEventListener('touchstart', this.touchstart)
|
||||||
document.addEventListener('touchmove', this.touchmove)
|
document.addEventListener('touchmove', this.touchmove)
|
||||||
document.addEventListener('touchend', this.touchend)
|
document.addEventListener('touchend', this.touchend)
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
this.$refs.bar.removeEventListener('touchmove', this.barListener)
|
||||||
document.removeEventListener('touchstart', this.touchstart)
|
document.removeEventListener('touchstart', this.touchstart)
|
||||||
document.removeEventListener('touchmove', this.touchmove)
|
document.removeEventListener('touchmove', this.touchmove)
|
||||||
document.removeEventListener('touchend', this.touchend)
|
document.removeEventListener('touchend', this.touchend)
|
||||||
@ -67,6 +72,10 @@ export default {
|
|||||||
this.y = touch.clientY
|
this.y = touch.clientY
|
||||||
},
|
},
|
||||||
|
|
||||||
|
barListener(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
},
|
||||||
|
|
||||||
touchstart(event) {
|
touchstart(event) {
|
||||||
this.getXY(event)
|
this.getXY(event)
|
||||||
// 判断是否是边缘滑动
|
// 判断是否是边缘滑动
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="mobile-back"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -208,9 +208,6 @@
|
|||||||
: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>
|
||||||
|
|
||||||
@ -255,7 +252,6 @@ export default {
|
|||||||
msgText: '',
|
msgText: '',
|
||||||
msgNew: 0,
|
msgNew: 0,
|
||||||
topId: 0,
|
topId: 0,
|
||||||
isFocus: false,
|
|
||||||
|
|
||||||
allMsgs: [],
|
allMsgs: [],
|
||||||
tempMsgs: [],
|
tempMsgs: [],
|
||||||
@ -285,14 +281,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
this.$refs.back.addEventListener('touchmove', this.backListener)
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
this.$refs.back.removeEventListener('touchmove', this.backListener)
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'userId',
|
'userId',
|
||||||
@ -648,12 +636,10 @@ 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")
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -832,10 +818,6 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
backListener(e) {
|
|
||||||
e.preventDefault()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
12
resources/assets/sass/components/mobile.scss
vendored
12
resources/assets/sass/components/mobile.scss
vendored
@ -129,6 +129,17 @@
|
|||||||
|
|
||||||
.mobile-back {
|
.mobile-back {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
|
.back-bar {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 20px;
|
||||||
|
z-index: 9998;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-semicircle {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 200px;
|
top: 200px;
|
||||||
left: -50px;
|
left: -50px;
|
||||||
@ -144,6 +155,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mobile-notification {
|
.mobile-notification {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@ -931,15 +931,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user