feat: 默认跳转第一个子菜单
This commit is contained in:
@ -63,8 +63,12 @@ export default defineComponent({
|
||||
}
|
||||
return _key;
|
||||
};
|
||||
const onClickItem = (name: string) => {
|
||||
router.push({ name });
|
||||
const onClickItem = (item: typeMenuItem) => {
|
||||
let targetRoute = item.routeName;
|
||||
if (item.children?.length) {
|
||||
targetRoute = item.children[0].routeName;
|
||||
}
|
||||
router.push({ name: targetRoute });
|
||||
};
|
||||
const renderMenuItem = (item: typeMenuItem, hideLabel = false) => {
|
||||
const getMenuItemClass = () => {
|
||||
@ -79,7 +83,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
return (
|
||||
<Menu.Item class={`menu-item ${getMenuItemClass()}`} onClick={() => onClickItem(item.routeName)}>
|
||||
<Menu.Item class={`menu-item ${getMenuItemClass()}`} onClick={() => onClickItem(item)}>
|
||||
{(() => {
|
||||
const isActive = getMenuItemClass() === 'active';
|
||||
const iconName = Array.isArray(item.icon)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px mt-24px pb-24px">
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px pb-24px">
|
||||
<div class="title-row">
|
||||
<span class="title">账号管理</span>
|
||||
<a-button type="outline" class="add-account-button" @click="handleAddAccount">添加子账号</a-button>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px mt-24px pb-24px">
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px pb-24px">
|
||||
<div class="title-row">
|
||||
<span class="title">企业信息</span>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px mt-24px pb-24px">
|
||||
<div class="bg-#fff rounded-8px w-100% py-0 px-20px pb-24px">
|
||||
<div class="title-row">
|
||||
<span class="title">个人信息</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user