update: 优化useParams
This commit is contained in:
parent
6919d41b93
commit
9b459f2507
|
@ -8,9 +8,7 @@ export const useRouterParams = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const routeName = router.currentRoute.value.name as string
|
const routeName = router.currentRoute.value.name as string
|
||||||
|
|
||||||
watchEffect(() => {
|
params.value = routeName && menu.params[routeName] ? menu.params[routeName] : {}
|
||||||
params.value = routeName && menu.params[routeName] ? menu.params[routeName] : {}
|
|
||||||
})
|
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (routeName && menu.params[routeName]) { // 如果当前路由params参数,离开页面清除掉
|
if (routeName && menu.params[routeName]) { // 如果当前路由params参数,离开页面清除掉
|
||||||
|
|
Loading…
Reference in New Issue