代码提交

This commit is contained in:
黄少君
2023-11-17 20:55:32 +08:00
parent 35b43ffd97
commit c3e62f8922
73 changed files with 1808 additions and 781 deletions

View File

@ -1,15 +1,27 @@
import { onPageScroll } from "@dcloudio/uni-app";
import { onLoad, onPageScroll } from "@dcloudio/uni-app";
import { onBeforeUnmount, ref } from "vue";
const scrollTop = ref(0)
export function useScroll(){
const scrollTop = ref(0)
onPageScroll((e)=>{
scrollTop.value = e.scrollTop
})
onBeforeUnmount(()=>{
scrollTop.value = 0
})
return {
scrollTop
function scrollToTop(){
uni.pageScrollTo({
scrollTop: 0,
duration: 500
})
}
return {
scrollTop,
scrollToTop
}
}