aaac7fed
liuqimichale
add
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { warn } from '../util/debug'
export function wheelMixin(BScroll) {
BScroll.prototype.wheelTo = function (index = 0) {
if (this.options.wheel) {
this.y = -index * this.itemHeight
this.scrollTo(0, this.y)
}
}
BScroll.prototype.getSelectedIndex = function () {
return this.options.wheel && this.selectedIndex
}
BScroll.prototype._initWheel = function () {
const wheel = this.options.wheel
if (!wheel.wheelWrapperClass) {
wheel.wheelWrapperClass = 'wheel-scroll'
}
if (!wheel.wheelItemClass) {
wheel.wheelItemClass = 'wheel-item'
}
if (wheel.selectedIndex === undefined) {
wheel.selectedIndex = 0
warn('wheel option selectedIndex is required!')
}
}
}
|