解决左侧子菜单标题不显示问题

This commit is contained in:
icssoa 2021-07-02 11:25:40 +08:00
parent 607c27d6e7
commit b010d35153
5 changed files with 23 additions and 13 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
*.js text eol=lf
*.json text eol=lf
*.ts text eol=lf

View File

@ -1,6 +1,6 @@
{ {
"name": "front-next", "name": "front-next",
"version": "0.5.1", "version": "0.5.2",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc --noEmit --skipLibCheck && vite build", "build": "vue-tsc --noEmit --skipLibCheck && vite build",
@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"array.prototype.flat": "^1.2.4", "array.prototype.flat": "^1.2.4",
"axios": "^0.21.1", "axios": "^0.21.1",
"cl-admin-crud-vue3": "^0.3.0", "cl-admin-crud-vue3": "^0.3.12",
"clipboard": "^2.0.8", "clipboard": "^2.0.8",
"clone-deep": "^4.0.1", "clone-deep": "^4.0.1",
"codemirror": "^5.60.0", "codemirror": "^5.60.0",

View File

@ -50,6 +50,12 @@
} }
} }
} }
&__popup {
.icon-svg {
margin-right: 10px;
}
}
} }
.cl-slider-menu__submenu { .cl-slider-menu__submenu {

View File

@ -51,7 +51,7 @@ export default defineComponent({
}, },
render(ctx: any) { render(ctx: any) {
function deepMenu(list: any) { function deepMenu(list: any, index: number) {
return list return list
.filter((e: any) => e.isShow) .filter((e: any) => e.isShow)
.map((e: any) => { .map((e: any) => {
@ -62,21 +62,22 @@ export default defineComponent({
<el-submenu></el-submenu>, <el-submenu></el-submenu>,
{ {
index: String(e.id), index: String(e.id),
key: e.id key: e.id,
"popper-class": "cl-slider-menu__popup"
}, },
{ {
title: () => { title: () => {
return !ctx.menuCollapse ? ( return ctx.menuCollapse && index == 1 ? (
<icon-svg name={e.icon}></icon-svg>
) : (
<span> <span>
<icon-svg name={e.icon}></icon-svg> <icon-svg name={e.icon}></icon-svg>
<span>{e.name}</span> <span>{e.name}</span>
</span> </span>
) : (
<icon-svg name={e.icon}></icon-svg>
); );
}, },
default() { default() {
return deepMenu(e.children); return deepMenu(e.children, index + 1);
} }
} }
); );
@ -102,7 +103,7 @@ export default defineComponent({
}); });
} }
const children = deepMenu(ctx.menuList); const children = deepMenu(ctx.menuList, 1);
return ( return (
ctx.visible && ( ctx.visible && (

View File

@ -930,10 +930,10 @@ change-case@^4.1.2:
optionalDependencies: optionalDependencies:
fsevents "~2.3.1" fsevents "~2.3.1"
cl-admin-crud-vue3@^0.3.0: cl-admin-crud-vue3@^0.3.12:
version "0.3.0" version "0.3.12"
resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.0.tgz?cache=0&sync_timestamp=1624438098113&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcl-admin-crud-vue3%2Fdownload%2Fcl-admin-crud-vue3-0.3.0.tgz#393c314bb7c20f84f2d4d460fe62b3c538f3e1b3" resolved "https://registry.nlark.com/cl-admin-crud-vue3/download/cl-admin-crud-vue3-0.3.12.tgz#afbbb52711f8f6e032dcacbd22977c9fa58d8662"
integrity sha1-OTwxS7fCD4Ty1NRg/mKzxTjz4bM= integrity sha1-r7u1JxH49uAy3Ky9Ipd8n6WNhmI=
dependencies: dependencies:
array.prototype.flat "^1.2.4" array.prototype.flat "^1.2.4"
core-js "^3.6.5" core-js "^3.6.5"