From 91211241797843e0367ff9795bf724c3cbaae814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E5=AD=90=E6=B9=98?= Date: Tue, 11 Oct 2022 16:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20=E5=A4=9A=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E8=8F=9C=E5=8D=95=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=BC=A9=E8=BF=9B=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=BA=E4=B8=8D?= =?UTF-8?q?=E7=BC=A9=E8=BF=9B=EF=BC=8C=E5=8F=AF=E9=80=9A=E8=BF=87=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/component/src/component/menu/index.less | 7 +------ package/component/src/component/menu/index.vue | 12 ++++++++++++ package/component/src/component/menu/utils.ts | 17 +++++++++++++++++ .../component/src/component/menuItem/index.vue | 3 +++ .../component/src/component/subMenu/index.vue | 14 +++++++++++++- 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 package/component/src/component/menu/utils.ts diff --git a/package/component/src/component/menu/index.less b/package/component/src/component/menu/index.less index 44fd112f..40d0bc0b 100644 --- a/package/component/src/component/menu/index.less +++ b/package/component/src/component/menu/index.less @@ -183,6 +183,7 @@ .layui-nav-tree .layui-nav-item { width: 100%; display: block; + box-sizing: border-box; line-height: 42px; } @@ -196,12 +197,6 @@ padding: 5px 23px 5px 23px; } -/* 嵌套垂直导航缩进 */ -.layui-nav-child > .layui-nav-item > div > dl.layui-nav-child > li { - box-sizing: border-box; - padding-left: 10px; -} - .layui-nav-tree .layui-nav-item * { color: rgba(255, 255, 255, 0.7); } diff --git a/package/component/src/component/menu/index.vue b/package/component/src/component/menu/index.vue index 748c1bc3..e1e2aefa 100644 --- a/package/component/src/component/menu/index.vue +++ b/package/component/src/component/menu/index.vue @@ -18,6 +18,7 @@ export interface LayMenuProps { level?: boolean | string; collapse?: boolean | string; collapseTransition?: boolean | string; + indent?: boolean | string; // 菜单栏是否缩进 } const emit = defineEmits([ @@ -36,6 +37,7 @@ const props = withDefaults(defineProps(), { level: true, collapse: false, collapseTransition: true, + indent: false, }); const isTree: ComputedRef = computed(() => props.tree); @@ -68,6 +70,15 @@ const selectedKey = computed({ }, }); +const indent = computed({ + get() { + return props.indent; + }, + set(val) { + // emit("update:indent", val); + }, +}); + watch( () => props.collapse, () => { @@ -87,6 +98,7 @@ provide("openKeys", openKeys); provide("isCollapse", isCollapse); provide("isCollapseTransition", isCollapseTransition); provide("menuTheme", menuTheme); +provide("indent", indent);