为什么touchmove事件未被触发,在BScroll加click:ture也没反应
来源:8-6 Vue项目城市选择页 - 兄弟组件数据传递
慕函数9246930
2020-04-29
<template>
<ul class="list">
<li
class="item"
v-for="item of letters"
:key="item"
:ref="item"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd"
@click="handleLetterClick"
>
{{ item }}
</li>
</ul>
</template>
<script>
export default {
name: "CityAlphabet",
props: {
cities: Object
},
data() {
return {
touchStatus: false //定义一个标识位
};
},
computed: {
letters() {
const letters = [];
for (let i in this.cities) {
letters.push(i);
}
return letters;
}
},
methods: {
handleLetterClick(e) {
this.$emit("change", e.target.innerText);
},
handleTouchStart() {
this.touchStatus = true;
},
handleTouchMove() {
if (this.touchStatus) {
const startY = this.$refs["A"][0].offsetTop;
console.log(startY);
}
},
handleTouchEnd() {
this.touchStatus = false;
}
}
};
</script>
2回答
-
骑猪的勇者
2020-05-13
请问下你是怎么解决的?我也是无法拖动显示
012020-05-13 -
慕函数9246930
提问者
2020-04-29
已解决
012020-08-01
相似问题