const handleClick = () => {
document.querySelector(".getScroll").scroll(0,0);
};
<div className="getScroll" style={{ height: '100%', overflow: 'scroll' }}>
<TouchableOpacity
onPress={handleClick}
style={{ position: 'absolute', right: 0, bottom: 50, zIndex: 100, backgroundColor: 'lightgreen' }}
>
<View>
<Text style={{ color: 'blue', fontSize: 16, lineHeight: 20 }}>回到顶部</Text>
</View>
</TouchableOpacity>
</div>
React js 返回顶部按钮
最新推荐文章于 2024-09-11 15:33:18 发布