menu 组件新增 inverted 属性

This commit is contained in:
就眠儀式
2022-01-30 20:29:16 +08:00
parent 6a1997f706
commit 098da28354
4 changed files with 72 additions and 11 deletions

View File

@@ -4,8 +4,8 @@
}
.layui-nav .layui-show.layui-anim-upbit .layui-nav-item {
display: block;
height: 40px;
display: block;
line-height: 40px;
}
@@ -164,8 +164,8 @@
.layui-nav-tree .layui-nav-item > a {
position: relative;
height: 42px;
line-height: 42px;
height: 40px;
line-height: 40px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
@@ -190,10 +190,8 @@
background-color: #009688;
}
.layui-nav-tree .layui-nav-child dd.layui-this,
.layui-nav-tree .layui-nav-child dd.layui-this a,
.layui-nav-tree .layui-this,
.layui-nav-tree .layui-this > a,
.layui-nav-tree .layui-nav-child dd.layui-this,
.layui-nav-tree .layui-this > a:hover {
background-color: #009688;
color: #fff;
@@ -281,6 +279,27 @@
}
}
.layui-nav-tree {
padding-top: 5px;
padding-bottom: 5px;
}
.layui-nav-tree .layui-this * {
color: white!important;
}
.layui-nav-tree.inverted .layui-this,
.layui-nav-tree.inverted .layui-this:hover {
border-radius: 4px;
margin: 0px 6px;
width: auto;
}
.layui-nav-tree.inverted .layui-this > a,
.layui-nav-tree.inverted .layui-this:hover > a {
border-radius: 4px;
}
.layui-nav-tree.inverted .layui-this > a{
padding: 5px 24px 5px 24px;
}

View File

@@ -1,5 +1,5 @@
<template>
<ul class="layui-nav" :class="[tree ? 'layui-nav-tree' : '', theme === 'dark' ? 'layui-nav-dark':'layui-nav-light' ]">
<ul class="layui-nav" :class="[inverted ? 'inverted':'',tree ? 'layui-nav-tree' : '', theme === 'dark' ? 'layui-nav-dark':'layui-nav-light' ]">
<slot></slot>
</ul>
</template>
@@ -13,6 +13,7 @@ export interface LayMenuProps {
openKeys?: string[];
tree?: boolean;
theme?: string;
inverted?: boolean;
}
const emit = defineEmits(["update:selectedKey", "update:openKeys"]);
@@ -21,7 +22,8 @@ const props = withDefaults(defineProps<LayMenuProps>(), {
selectedKey: "",
openKeys: () => [],
tree: false,
theme: 'dark'
theme: 'dark',
inverted: false
});
const isTree = computed(() => props.tree);