主题
组合式 API: onBeforeRouteUpdate()
onBeforeRouteUpdate()
该函数允许你在 setup 中直接注册 beforeRouteUpdate 路由守卫。
类型
tsfunction onBeforeRouteUpdate(guard: NavigationGuardWithThis): void示例
jsimport { onBeforeRouteUpdate } from '@/uni-simple-router' export default { setup(){ onBeforeRouteUpdate((to,from)=>{ console.log(to) }) } }参考 指南 - 组合式 API 及 指南 - 组件内的守卫