// 为了保证能下滑下去,先判断有没有数据再做处理
watch: {
list: {
handler(newVal, oldVal) {
let tath = this
if (newVal.length > 0 && this.scroll1 != '' && this.scroll1 != NaN) {
this.$nextTick(function() {
setTimeout(() => {
uni.pageScrollTo({
scrollTop: Number(tath.scroll1),
duration: 0
})
}, 50)
})
}
},
}
},
data() {
return {
// 在当前页面获取到滚动的距离
scroll: '',
// 符合的数据
arr: [],
// 下一个页面返回的距离
scroll1: ''
}
},
// 获取滚动到多少的距离apl
onPageScroll(e) {
this.scroll = e.scrollTop
console.log(this.scroll, 'this.scroll')
},
methods:{
// 点击每一项
itemLarning(item) {
uni.navigateTo({
url: `/pages/sys/learningItem/learningItem?&scroll=${this.scroll}`
})
},}
// 下一个页面
onLoad(options) {
this.options = options
this.queryParams.translateId = options.id
this.title = options.item
this.scroll = options.scroll
console.log(options, 'this.scroll传过去的')
},
methods:{
go() {
uni.navigateTo({
url: `/pages/sys/learning/learning?scroll=${this.scroll}`
})
},
}