The problem of better-scroll scrolling to the bottom in vue

the exception that vue better-scroll rolls to the bottom when a new message is loaded.
let disY=60; scrolls normally
let disY= el [el.length-1] .clientHeight; this makes scrolling unusual. See the picture below for details.

    RequestAxios(comment,function(){ 
    //
      _this._intervalLoad(function(){
          _this.$nextTick(()=>{
              let el=_this.$refs.recordWrap.childNodes;
              //let disY=60; 
              //
              let disY=el[el.length-1].clientHeight;
              if(el){
                  _this.chatScroll.scrollBy(0, _this.lastScrollY-disY,500);
                  setTimeout(()=>{
                    _this.lastScrollY= _this.chatScroll.y;
                  },50);
              }
          });
      }); 
    }); 
  },

Mar.14,2021

because the better-scroll calculation height does not include margin, you can use margin in the wrapper layer. Padding is recommended internally.

Menu