js 设置 页面或div容器 滚动scroll


 window.scrollTo(0, 0)
   document.documentElement.scrollTop  = 0


//
参考业务代码 this.$nextTick(() => { document.getElementById('comic').scrollTop = 0 this.spinningFlag = false window.scrollTo(0, 0) setTimeout(_ => { this.noRecmdBtnLoading = false this.recmdBtnLoading = false }) }) this.$nextTick(() => { if (this.queryParam.sp_type == '1' && document.getElementById('comic')) { document.getElementById('comic').scrollTop = 0 } else if (this.queryParam.sp_type == '2' && document.getElementById('avg')) { document.getElementById('avg').scrollTop = 0 } else if (this.queryParam.sp_type == '3' && document.getElementById('drama')) { document.getElementById('drama').scrollTop = 0 } this.spinningFlag = false })

 

 

 

 

 

 

 

posted @ 2022-03-18 15:49  hjswlqd  阅读(748)  评论(0编辑  收藏  举报