Skip to content

Commit

Permalink
chore: layout菜单修改
Browse files Browse the repository at this point in the history
  • Loading branch information
sdmu-gaoqi committed Jan 21, 2024
1 parent e33c73f commit e1a067c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
},
rules: {
'no-console': 'off',
"vue/no-use-v-if-with-v-for": 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"source.fixAll.eslint": "never",
"source.fixAll.stylelint": "never"
},
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"typescript.tsdk": "node_modules/typescript/lib"
}
38 changes: 21 additions & 17 deletions src/components/layout/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@
@click="handleClickMenu"
:selectedKeys="[tab]"
>
<template v-for="item in currentMenus" :key="item.key">
<a-sub-menu v-if="item.children && item.children?.length > 0">
<template v-for="item in currentMenus">
<a-sub-menu
v-if="item.children && item.children?.length > 0"
:key="item.key"
>
<template #title>
<span>
<img
Expand All @@ -64,23 +67,24 @@
{{ renderName(item) }}
</span>
</template>
<template v-for="children in item.children" :key="children.key">
<a-menu-item v-if="item.children && item.children.length > 0">{{
renderName(children)
}}</a-menu-item>
<template v-for="children in item.children">
<a-menu-item
v-if="item.children && item.children.length > 0"
:key="children.key"
>{{ renderName(children) }}</a-menu-item
>
</template>
</a-sub-menu>
<a-menu-item
v-else-if="!item.children || item.children?.length === 0"
:key="item.key"
>
<img
:src="item.icon"
v-if="item.icon"
class="h-[15px] mr-[5px]"
/>
{{ renderName(item) }}
</a-menu-item>
<template v-else-if="!item.children || item.children?.length === 0">
<a-menu-item :key="item.key">
<img
:src="item.icon"
v-if="item.icon"
class="h-[15px] mr-[5px]"
/>
{{ renderName(item) }}
</a-menu-item>
</template>
</template>
</a-menu>
</a-layout-sider>
Expand Down

0 comments on commit e1a067c

Please sign in to comment.