add () {
//设置滚动内容在底部
this.$nextTick(() => {
let div = this.$refs.div
console.log(div.scrollHeight)
//盒子滚动高度 盒子距离顶部的高度
div.scrollTop = div.scrollHeight;
if (document.body.scrollHeight > 0) {
window.scrollTo({ top: div.scrollHeight, left: 0 })
}
})
}
主要事件scrollTo