fix: 修复 menu 组件 openKeys 属性失效

This commit is contained in:
就眠儀式 2022-03-31 22:25:59 +08:00
parent fcc3be11fc
commit e10e7697f7
6 changed files with 7 additions and 12 deletions

View File

@ -20,6 +20,7 @@
<li>[修复] transfer 组件 showSearch 属性类型警告。</li>
<li>[修复] upload 组件 number 属性必填警告。</li>
<li>[修复] variable 全局变量重复导入的问题。</li>
<li>[修复] menu 组件 openKeys 属性失效。</li>
<li>[支持] icon 列表复制。</li>
<li>[支持] 夜间模式。</li>
</ul>

View File

@ -1,6 +1,6 @@
{
"name": "@layui/layui-vue",
"version": "0.4.5-alpha.2",
"version": "0.4.5-alpha.5",
"author": "就眠儀式",
"license": "MIT",
"description": "a component library for Vue 3 base on layui-vue",

View File

@ -1,19 +1,17 @@
@import (reference) "../../theme/variable.less";
@card-border-radius: var(--card-border-radius);
@card-back-color: var(--card-back-color);
@card-fore-color: var(--card-fore-color);
:root {
--card-border-radius: @global-border-radius;
--card-back-color: @global-back-color;
--card-fore-color: @global-fore-color;
}
.layui-card {
margin-bottom: 15px;
border-radius: @card-border-radius;
background-color: @card-back-color;
background-color: #ffffff;
.layui-card-header {
height: 42px;
line-height: 42px;

View File

@ -32,11 +32,11 @@ const props = withDefaults(defineProps<LayMenuProps>(), {
collapseTransition: true,
});
let oldOpenKeys = ref<string[]>([]);
const isTree = computed(() => props.tree);
const isCollapse = computed(() => props.collapse);
const isCollapseTransition = computed(() => props.collapseTransition);
let oldOpenKeys = ref<string[]>(props.openKeys);
const openKeys = computed({
get() {
@ -67,8 +67,7 @@ watch(
//
emit("update:openKeys", oldOpenKeys.value);
}
},
{ immediate: true }
}, { immediate: true }
);
provide("isTree", isTree);

View File

@ -23,16 +23,13 @@ export interface LaySubMenuProps {
}
const slots = useSlots();
const props = defineProps<LaySubMenuProps>();
const isTree: Ref<boolean> = inject("isTree") as Ref<boolean>;
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;
const openKeys: Ref<string[]> = inject("openKeys") as Ref<string[]>;
const isCollapse: Ref<boolean> = inject("isCollapse") as Ref<boolean>;
const isCollapseTransition: Ref<boolean> = inject(
"isCollapseTransition"
) as Ref<boolean>;
const isCollapseTransition: Ref<boolean> = inject("isCollapseTransition") as Ref<boolean>;
const isOpen = computed(() => {
return openKeys.value.includes(props.id);

View File

@ -41,7 +41,7 @@ const emit = defineEmits([
"change",
"row-double",
"update:selectedKeys",
"contextmenu"
"contextmenu",
]);
const slot = useSlots();