🐛(menu): 修复 menu 组件 mored 图标不随状态变化

This commit is contained in:
就眠儀式 2022-05-12 05:45:43 +08:00
parent 28fe83c02d
commit ea06a05198
5 changed files with 9 additions and 15 deletions

View File

@ -308,9 +308,4 @@
.layui-nav-child {
background-color: transparent;
}
}
.layui-nav-child-spacing .layui-nav-item .layui-nav-child {
padding-left: 10px;
box-sizing: border-box;
}
}

View File

@ -12,7 +12,6 @@ import {
Ref,
ref,
watch,
WritableComputedRef,
} from "vue";
import "./index.less";
@ -25,7 +24,6 @@ export interface LayMenuProps {
level?: boolean | string;
collapse?: boolean | string;
collapseTransition?: boolean | string;
childSpacing?: boolean;
}
const emit = defineEmits([
@ -43,8 +41,7 @@ const props = withDefaults(defineProps<LayMenuProps>(), {
inverted: false,
level: true,
collapse: false,
collapseTransition: true,
childSpacing: false,
collapseTransition: true
});
const isTree: ComputedRef = computed(() => props.tree);
@ -102,8 +99,7 @@ provide("isCollapseTransition", isCollapseTransition);
inverted ? 'inverted' : '',
tree ? 'layui-nav-tree' : '',
theme === 'dark' ? 'layui-nav-dark' : 'layui-nav-light',
collapse ? 'layui-nav-collapse' : '',
childSpacing ? 'layui-nav-child-spacing' : '',
collapse ? 'layui-nav-collapse' : ''
]"
>
<slot></slot>

View File

@ -89,14 +89,17 @@ onBeforeUnmount(() => window.removeEventListener("resize", setPosition));
<template>
<li class="layui-nav-item">
<a href="javascript:void(0)" @click="openHandle()">
<!-- 图标 -->
<i>
<slot v-if="slots.icon" name="icon"></slot>
</i>
<!-- 标题 -->
<span>
<slot v-if="slots.title" name="title"></slot>
</span>
<!-- 扩展 -->
<i
:class="[isOpen && !isTree ? 'layui-nav-mored' : '']"
:class="[isOpen ? 'layui-nav-mored' : '']"
class="layui-icon layui-icon-down layui-nav-more"
></i>
</a>

View File

@ -36,4 +36,4 @@ export default (md: MarkdownIt): void => {
return true;
};
md.block.ruler.before("fence", "snippet", parser);
};
};

View File

@ -37,7 +37,7 @@ export const usePlayGround = async (
code = `${decodeCode}
<script lang="ts" setup>
</script>`
</script>`;
}
// 去除 export default,保留其中的内容