右侧快速入口滑动时左侧跟着变化
1 <!--右侧字母--> 2 <div class="list-shortcut" > 3 <ul> 4 <li v-for="(item,index) of shortcutList" @touchstart.stop.prevent="onShortcutTouchStart" @touchmove.stop.prevent="onShortcutTouchMove" :data-index="index" class="item">{{item}}</li> 5 </ul> 6 </div> 7 8 9 10 11 事件方法: 12 onShortcutTouchStart(e){ 13 let anchorIndex = getData(e.target, 'index') 14 // this.$refs.listview.scrollToElement(this.$refs.listGroup[anchorIndex],0) 15 // 右侧滑动代码 16 let firstTouch = e.touches[0] 17 this.touch.y1 = firstTouch.pageY 18 this.touch.anchorIndex = anchorIndex 19 this. _scrollTo(anchorIndex) 20 }, 21 onShortcutTouchMove(e){ 22 let firstTouch = e.touches[0] 23 this.touch.y2 = firstTouch.pageY 24 let delta = (this.touch.y2 - this.touch.y1) / ANCHOR_HEIGHT | 0//移动的了几个字母;/18移动了几个锚点 25 let anchorIndex = parseInt(this.touch.anchorIndex) + delta 26 this. _scrollTo(anchorIndex) 27 }, 28 _scrollTo(index){ 29 this.$refs.listview.scrollToElement(this.$refs.listGroup[index],0) 30 }
一辈子很短,努力的做好两件事就好;第一件事是热爱生活,好好的去爱身边的人;第二件事是努力学习,在工作中取得不一样的成绩,实现自己的价值,而不是仅仅为了赚钱;