mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
refactor:优化会员中心菜单点击时的处理函数逻辑
This commit is contained in:
parent
028710bcb9
commit
674fe82f46
@ -36,7 +36,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="(menu, index) in item.children"
|
v-for="(menu, index) in item.children"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="routerPush('', menu)"
|
@click="routerPush(menu)"
|
||||||
class="user-menu-item"
|
class="user-menu-item"
|
||||||
:class="route.fullPath == menu.path ? 'active' : ''"
|
:class="route.fullPath == menu.path ? 'active' : ''"
|
||||||
>
|
>
|
||||||
@ -60,10 +60,10 @@ const router = useRouter()
|
|||||||
const userInfo = useUserInfo()
|
const userInfo = useUserInfo()
|
||||||
const memberCenter = useMemberCenter()
|
const memberCenter = useMemberCenter()
|
||||||
|
|
||||||
const routerPush = (routeName: string, route?: RouteRecordRaw) => {
|
const routerPush = (route: string | RouteRecordRaw) => {
|
||||||
if (routeName) {
|
if (typeof route === 'string') {
|
||||||
router.push({ name: routeName })
|
router.push({ name: route })
|
||||||
} else if (route) {
|
} else {
|
||||||
onClickMenu(route)
|
onClickMenu(route)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user