haishen
export default {
    data () {
        return {
            timer: null, // 定时器
        }
    }
}

created () {
    const that = this
    that.timer = setInterval(function () {
        console.log(document.readyState)
        if (document.readyState === \'complete\') {
            that._scrollToBottom() // 将聊天框滚轮拉到最底部
            window.clearInterval(that.timer)
        }
    }, 1000)
},

 

上述代码应用场景,---h5聊天页,由于created的时候只是页面元素的节点加载进来了,图片、音频等资源还未加载完全,导致滚轮无法拉至最底部

this.$nextTick 也不起作用

 

分类:

技术点:

相关文章:

  • 2021-11-05
  • 2021-11-22
  • 2021-11-19
  • 2021-11-12
  • 2021-11-18
  • 2021-11-18
  • 2021-11-18
猜你喜欢
  • 2021-11-18
  • 2021-11-29
  • 2021-09-12
  • 2021-11-28
  • 2021-05-17
  • 2021-11-18
  • 2021-11-19
相关资源
相似解决方案