diff --git a/dist/index/index.js b/dist/index/index.js index c556f19..2690a9a 100644 --- a/dist/index/index.js +++ b/dist/index/index.js @@ -52,7 +52,7 @@ Component({ timer : null }) } - + this.data.timer = setTimeout(()=>{ const data = []; indexItems.forEach((item) => { @@ -71,7 +71,7 @@ Component({ this.setData({ timer : this.data.timer }) - + } }, handlerScroll(event){ @@ -117,7 +117,7 @@ Component({ const touches = event.touches[0] || {}; const pageY = touches.pageY; const rest = pageY - data.startTop; - let index = Math.ceil( rest/data.itemHeight ); + let index = Math.floor( rest/data.itemHeight ); index = index >= data.itemLength ? data.itemLength -1 : index; const movePosition = this.getCurrentItem(index); @@ -155,4 +155,4 @@ Component({ }).exec() } } -}) \ No newline at end of file +})