1:不能写成死值
<scroll-view :scroll-into-view="scrollIntoView" scroll-with-animation class="index-container" scroll-y="true" @scroll="handleScroll">
2:且要变化,否则再次触发返回顶部的时候 会失效
let scrollIntoView = ref('')
function handleScroll(event) {
scrollIntoView.value = ''
}
function backToTop() {
scrollIntoView.value = "top"
}
0 个评论
要回复文章请先登录或注册