onClick() {
this.$nextTick(() => {
document.documentElement.scrollTop = document.body.scrollTop = this.list[this.active].scrollTop
})
if (this.list[this.active].products.length > 0) return
this.list[this.active].loading = true;
this.onLoad()
},
onLoad() {
const data = {
newsType: this.active == 0 ? null : this.active,
pageNum: this.list[this.active].page,
pageSize: this.pages.size
}
newsManager(data).then(res => {
res.data.list.map(item => {
item.videoThumb = JSON.parse(item.videoThumb)
item.newsImgs = item.newsImgs ? JSON.parse(item.newsImgs) : []
})
this.list[this.active].products = this.list[this.active].products.concat(res.data.list)
if (res.data.list.length > 0) {
this.list[this.active].page++
}
// 加载状态结束
this.list[this.active].loading = false;
// 数据全部加载完成
if (this.list[this.active].page > res.data.totalPage) {
this.list[this.active].finished = true;
}
})
},
handleScroll() {
let s = document.documentElement.scrollTop || document.body.scrollTop
this.list[this.active].scrollTop = s
if (s >= 100) {
s = 100
}
this.$refs.nav.$el.style.background = `rgba(255,255,255, ${s * 0.01})`
},