问题遇到的现象和发生背景
左右联动使用better-scroll后会回退到起始位置
this.scroll.scrollTo(0,-this.allHeight[index],300);写法没问题为什么还会回退到初始位置
问题相关代码,请勿粘贴截图
```javascript
<!-- 右侧内容部分 -->
<div class="ultwo" ref="right">
<ul @scroll="scrollClick($event)" >
<li v-for="(i, ind) in img" :key="ind" class="li">
<div
class="ultwodiv"
v-for="(item, index) in i.app_category_items"
:key="index"
>
<van-image
width="100%"
height="80"
:src="item.cover"
class="vanimg"
/>
<p>{{ item.name }}</p>
</div>
</li>
</ul>
</div>
```javascript
onChange(index) {
// let ul = document.querySelector('ul')
let uls = this.scroll.content.childNodes;
console.log(uls);
let height = 0;
this.allHeight.push(height);
uls.forEach((v) => {
height += v.scrollHeight;
// console.log(v.clientHeight);
this.allHeight.push(height);
console.log(height);
});
console.log();
this.scroll.scrollTo(0,-this.allHeight[index],300);
},
```javascript
mounted() {
if (!this.scroll) {
this.$nextTick(() => {
this.scroll = new b(this.$refs.right, {
click: true,
});
console.log(this.scroll);
});
}else{
this.scroll.refresh()
}