提交 63fa0d5e 编写于 作者: Q qiang

fix: 解决 picker、picker-view 组件滚动停止过慢的问题 fixed #278 fixed #367

上级 523a75b3
<script>
import touchtrack from 'uni-mixins/touchtrack'
import scroller from 'uni-mixins/scroller/index'
import { Friction } from 'uni-mixins/scroller/Friction'
import { Spring } from 'uni-mixins/scroller/Spring'
export default {
name: 'PickerViewColumn',
......@@ -108,6 +110,8 @@ export default {
enableX: false,
enableSnap: true,
itemSize: this.indicatorHeight,
friction: new Friction(0.0001),
spring: new Spring(2, 90, 20),
onSnap: (index) => {
if ((!isNaN(index)) && index !== this.current) {
this.current = index
......
import { Friction } from './Friction'
import { Spring } from './Spring'
export function Scroll (extent) {
export function Scroll (extent, friction, spring) {
this._extent = extent
this._friction = new Friction(0.01)
this._spring = new Spring(1, 90, 20)
this._friction = friction || new Friction(0.01)
this._spring = spring || new Spring(1, 90, 20)
this._startTime = 0
this._springing = false
this._springOffset = 0
......
......@@ -53,7 +53,7 @@ export function Scroller (element, options) {
}
this._position = 0
this._scroll = new Scroll(this._extent)
this._scroll = new Scroll(this._extent, options.friction, options.spring)
this._onTransitionEnd = this.onTransitionEnd.bind(this)
this.updatePosition()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册