touch移動后取消導(dǎo)致click點(diǎn)擊無效呕屎, 需要再次點(diǎn)擊才可以沼本, 這里使用touch來替代頁面上的click時(shí)間,touch延遲到替換click
- 頁面所有的點(diǎn)擊用這個(gè)組件包裝
<template>
<view @touchstart="touchstart" @touchmove="touchmove">
<slot></slot>
</view>
</template>
<script>
export default {
data() {
return {
clicking: false,
move: false,
}
},
methods: {
touchmove(e){
this.move = true
},
touchstart(e){
this.move = false
if(this.clicking == true && !this.touchEnd){
return;
}
this.touchEnd = false
this.clicking = true;
setTimeout(e=>{
this.clicking = false
if(!this.move){
this.$emit('click')
}
}, 250)
}
}
}
</script>
<style>
</style>