update: 优化useParams

This commit is contained in:
xieyonghong 2023-03-27 09:22:24 +08:00
parent 6919d41b93
commit 9b459f2507
1 changed files with 1 additions and 3 deletions

View File

@ -8,9 +8,7 @@ export const useRouterParams = () => {
const router = useRouter();
const routeName = router.currentRoute.value.name as string
watchEffect(() => {
params.value = routeName && menu.params[routeName] ? menu.params[routeName] : {}
})
onBeforeUnmount(() => {
if (routeName && menu.params[routeName]) { // 如果当前路由params参数离开页面清除掉