1. For some business requirements, you need to cache the scroll location you selected before. For example, record the index of the current selection list li, and the next time you visit the page, initially scroll to that index. Is there any good method in better-scroll? I call my own scrollToElement, and weelTo. There is no real-time response.
2. Partial initialization code is attached
new Promise((resolve, reject) => {
if (!this.wheels) {
this.wheels = []
for (let i = 0; i < 3; iPP) {
this.wheels[i] = new Bscroll(this.$refs.wheelWrapper.children[i], {
wheel: {
selectedIndex: 5,
adjustTime: 400,
/** */
wheelWrapperClass: "wheel-scroll",
wheelItemClass: "wheel-item"
},
probeType: 3
})
}
}
else {
for (let i = 0; i < 3; iPP) {
this.wheels[i].refresh()
}
}
resolve()
}).then(() => {
this.week1 = this.$refs.weekWrapper.children[6]
let weekChild = this.week1
console.log(weekChild)
this.wheels[0].scrollToElement(weekChild,0)//
})
}
Please give us some advice, thank you.