其实只要把跳转前的滚动条位置保存下来,返回页面时再赋予就行,代码如下:
//this.scroll = 0
clickFn(event, { index, value }){//跳转前
this.scroll = document.getElementsByClassName("vue-waterfall-easy-scroll")[0].scrollTop;
this.$router.push({
...
});
},
activated() {
this.$nextTick(() => {
setTimeout(() => {
document.getElementsByClassName("vue-waterfall-easy-scroll")[0].scrollTop = this.scroll;
}, 0);
});
},