从这位大哥这看到的
https://blog.csdn.net/weixin_42981560/article/details/93875904
我的需求是将"评论"的list列表的滚动条固定在底部,每当有新的评论,或者添加了评论就能看到最新的.
mounted() {
this.scrollToBottom();
},
updated: () {
this.scrollToBottom();
},
method(){
scrollToBottom() {
this.$nextTick(() => {
var container = this.$el.querySelector("#你要实现滚动条置底的元素ID");
container.scrollTop = container.scrollHeight;
})
}
}