VUE prevents the mobile terminal from sliding the default behavior: left and right and up and down
<template>
<div :id="id" class="chart" :ref="id" @touchend="remove" @touchstart="start"></div>
</template>
<script>
export default {
props: {
// 取消走势图默认事件
stopPrev: {
type: Boolean,
default: false,
},
},
//...
methods: {
start(e) {
if (this.stopPrev) {
e.preventDefault()
}
},
},
}
</script>
VUE prevents the mobile terminal from sliding left and right by default
<template>
<div :id="id" :class="{ chart: true, touch_y: stopPrev }" :ref="id" @touchend="remove"></div>
</template>
<script>
export default {
props: {
// 取消走势图横向滑动默认事件
stopPrev: {
type: Boolean,
default: false,
},
},
}
</script>
<style scoped>
.chart {
width: 100%;
height: 100%;
}
.touch_y {
touch-action: none;
touch-action: pan-y;
}
</style>
Prevent the mobile terminal H5 development browser from sliding left and right by default