fix: menu cannot be collapsed by the Layout (#2819)

This commit is contained in:
John60676 2020-09-17 14:51:32 +08:00 committed by GitHub
parent c78e9418a4
commit c1cfabb20e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { inject, provide } from 'vue';
import { inject, provide, toRef } from 'vue';
import omit from 'omit.js';
import VcMenu, { Divider, ItemGroup } from '../vc-menu';
import SubMenu from './SubMenu';
@ -61,9 +61,12 @@ const Menu = {
provide('menuPropsContext', this.$props);
},
setup() {
const layoutSiderContext = inject('layoutSiderContext', {});
const layoutSiderCollapsed = toRef(layoutSiderContext, 'sCollapsed');
return {
configProvider: inject('configProvider', ConfigConsumerProps),
layoutSiderContext: inject('layoutSiderContext', {}),
layoutSiderContext,
layoutSiderCollapsed,
};
},
// model: {
@ -88,7 +91,7 @@ const Menu = {
inlineCollapsed(val) {
this.collapsedChange(val);
},
'layoutSiderContext.sCollapsed'(val) {
layoutSiderCollapsed(val) {
this.collapsedChange(val);
},
},