.vue mounted(){ this.scrollToBottom()
}, methods:{ scrollToBottom: function () { this.$nextTick(() => { var container = this.$el.querySelector('.chatContent');
container.scrollTop = container.scrollHeight;
})
}
}, updated:function () { this.scrollToBottom();
}就想讓div滾動條始終在底部,咋就這么難。。。補充:目前調試的是針對響應式的時候,div高度拉長,滾動條居底部
1 回答

滄海一幻覺
TA貢獻1824條經驗 獲得超5個贊
updated () { this.$nextTick(function () { container.scrollTop = container.scrollHeight; }); },
- 1 回答
- 0 關注
- 2866 瀏覽
添加回答
舉報
0/150
提交
取消