Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Indexlist with touch event warning in chrome #1546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions packages/index-list/src/index-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<ul class="mint-indexlist-content" ref="content" :style="{ 'height': currentHeight + 'px', 'margin-right': navWidth + 'px'}">
<slot></slot>
</ul>

<div class="mint-indexlist-nav" @touchstart="handleTouchStart" ref="nav">
<ul class="mint-indexlist-navlist">
<li class="mint-indexlist-navitem" v-for="section in sections">{{ section.index }}</li>
</ul>
</div>

<div class="mint-indexlist-indicator" v-if="showIndicator" v-show="moving">{{ currentIndicator }}</div>
</div>
</template>
Expand All @@ -22,13 +22,13 @@
width: 100%;
position: relative;
overflow: hidden;

@descendent content {
margin: 0;
padding: 0;
overflow: auto;
}

@descendent nav {
position: absolute;
top: 0;
Expand All @@ -43,7 +43,7 @@
flex-direction: column;
justify-content: center;
}

@descendent navlist {
padding: 0;
margin: 0;
Expand All @@ -52,14 +52,14 @@
display: flex;
flex-direction: column;
}

@descendent navitem {
padding: 2px 6px;
font-size: 12px;
user-select: none;
-webkit-touch-callout: none;
}

@descendent indicator {
position: absolute;
size: 50px;
Expand Down Expand Up @@ -148,8 +148,12 @@
this.moving = false;
this.currentIndicator = '';
}, 500);
window.removeEventListener('touchmove', this.handleTouchMove);
window.removeEventListener('touchend', this.handleTouchEnd);
window.removeEventListener('touchmove', this.handleTouchMove, {
passive: false
});
window.removeEventListener('touchend', this.handleTouchEnd, {
passive: false
});
},

scrollList(y) {
Expand Down