uniapp:js push数据后,使用uni.pageScrollTo使页面滑倒最底部

this.$nextTick(() => {
    
    
	// 获取滚动区域的高度
	uni.createSelectorQuery().select('#lists')
		.boundingClientRect((rect) => {
    
    
		// rect.height 是滚动区域的高度
		// 滑动到底部
		uni.pageScrollTo({
    
    
			scrollTop: rect.height,
			duration: 300 // 可根据需求设置滚动动画时长
		});
	}).exec();
});

猜你喜欢

转载自blog.csdn.net/qq_40745143/article/details/134610609