Invalid scrollTop assignment in vue component. Many methods have been tried.

.vue

   mounted(){
        this.scrollToBottom()
    },
    methods:{
        scrollToBottom: function () {
            this.$nextTick(() => {
                var container = this.$el.querySelector(".chatContent");
                container.scrollTop = container.scrollHeight;
            })
        }
    },
    updated:function () {
        this.scrollToBottom();
    }
    

it"s so hard to keep the div scroll bar at the bottom all the time.
add: the current debugging is aimed at the responsive type, when the div is highly elongated and the scroll bar is at the bottom

May.15,2022

updated () {
    this.$nextTick(function () {
        container.scrollTop = container.scrollHeight;
    });
},

container.scrollTo = container.scrollHeight;

Menu