mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 03:11:15 +00:00
fix(Swipe): avoid Vue 2.6 event bubble issues (#5346)
This commit is contained in:
@@ -130,10 +130,16 @@ export default createComponent({
|
||||
|
||||
minOffset() {
|
||||
const rect = this.$el.getBoundingClientRect();
|
||||
return (this.vertical ? rect.height : rect.width) - this.size * this.count;
|
||||
return (
|
||||
(this.vertical ? rect.height : rect.width) - this.size * this.count
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.bindTouchEvent(this.$refs.track);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// initialize swipe position
|
||||
initialize(active = this.initialSwipe) {
|
||||
@@ -344,15 +350,7 @@ export default createComponent({
|
||||
render() {
|
||||
return (
|
||||
<div class={bem()}>
|
||||
<div
|
||||
ref="track"
|
||||
style={this.trackStyle}
|
||||
class={bem('track')}
|
||||
onTouchstart={this.onTouchStart}
|
||||
onTouchmove={this.onTouchMove}
|
||||
onTouchend={this.onTouchEnd}
|
||||
onTouchcancel={this.onTouchEnd}
|
||||
>
|
||||
<div ref="track" style={this.trackStyle} class={bem('track')}>
|
||||
{this.slots()}
|
||||
</div>
|
||||
{this.genIndicator()}
|
||||
|
Reference in New Issue
Block a user