Appearance
usePageInit
页面初始化 Hook,兼容 KeepAlive 缓存模式。首次加载和从缓存恢复时都会触发初始化函数,自动去重防止重复执行。
ts
import { usePageInit } from 'yoyoo-ui'
usePageInit(async () => {
await loadPageData()
})| 参数 | 类型 | 说明 |
|---|---|---|
| initFn | () => void | 初始化函数(通常用于请求接口数据) |