fix:bug解决

This commit is contained in:
李伊帆
2026-10-28 10:36:39 +08:00
parent c369127166
commit 91bca314ba
57 changed files with 2839 additions and 384 deletions

View File

@@ -0,0 +1,20 @@
import { onShow } from '@dcloudio/uni-app'
/**
* 页面再次显示时执行刷新(从子页返回、切换 Tab 等)。
* skipInitialShow:首屏由 onLoad 加载时设为 true,避免与 onLoad 重复请求。
*/
export function usePageShowRefresh(
handler: () => void | Promise<void>,
options?: { skipInitialShow?: boolean },
) {
let skipFirst = Boolean(options?.skipInitialShow)
onShow(() => {
if (skipFirst) {
skipFirst = false
return
}
void handler()
})
}