阅读背景:

vue切换页面时让滚动轴置顶的兼容性写法

来源:互联网 
!-- flowchart 箭头图标 勿删 --
router.afterEach((to, from, next) => {切换页面时触发
    window.scrollTo(0, 0) 这一行要不要都行
    Vue.nextTick(() => { 这是dom渲染完执行
            if (document.querySelector('.app-content') && document.querySelector('.app-content').scrollTo) {
                document.querySelector('.app-content').scrollTo(0, 0) 这种写法oppo手机不支持 所以再加个else
            } else {
                document.querySelector('.app-content').scrollTop = 0
            }
        })
})
router.aft



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: