mounted () {
this.scrollToBottom();
},
//每次页面渲染完之后滚动条在最底部
updated:function(){
this.scrollToBottom();
},
methods: {
//
scrollToBottom() {
this.$nextTick(() => {
var container = this.$el.querySelector(" 需要滚动条处于底部的容器,css类名 ");
container.scrollTop = container.scrollHeight;
})}
}
关于获取this.$el.querySelector的知识,可以参考这里: