mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix: SimpleRootMenuContextProps type error (#3176)
This commit is contained in:
parent
6f7d840128
commit
83aa1da3de
@ -97,8 +97,7 @@
|
||||
opt.rootClassName = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls;
|
||||
|
||||
if (!getContainer) {
|
||||
// TODO type error?
|
||||
opt.getContainer = `.${prefixVar}-layout-content` as any;
|
||||
opt.getContainer = `.${prefixVar}-layout-content`;
|
||||
}
|
||||
}
|
||||
return opt as DrawerProps;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import { createSimpleRootMenuContext } from './useSimpleMenuContext';
|
||||
import { createSimpleRootMenuContext, type MenuEmitterEvents } from './useSimpleMenuContext';
|
||||
import { mitt } from '/@/utils/mitt';
|
||||
|
||||
export default defineComponent({
|
||||
@ -45,14 +45,7 @@
|
||||
},
|
||||
emits: ['select', 'open-change'],
|
||||
setup(props, { emit }) {
|
||||
const rootMenuEmitter = mitt<{
|
||||
'on-update-opened': (string | number)[];
|
||||
'on-menu-item-select': string | number;
|
||||
'open-name-change': {
|
||||
name: string;
|
||||
opened: boolean;
|
||||
};
|
||||
}>();
|
||||
const rootMenuEmitter = mitt<MenuEmitterEvents>();
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const currentActiveName = ref<string | number>('');
|
||||
|
@ -49,7 +49,7 @@ export function useMenuItem(instance: ComponentInternalInstance | null) {
|
||||
uidList: [],
|
||||
list: [],
|
||||
};
|
||||
const ret: any[] = [];
|
||||
const ret: ComponentInternalInstance[] = [];
|
||||
while (parent && parent.type.name !== 'Menu') {
|
||||
if (parent.type.name === 'SubMenu') {
|
||||
ret.push(parent);
|
||||
|
@ -1,9 +1,25 @@
|
||||
import type { InjectionKey, Ref } from 'vue';
|
||||
import type { InjectionKey, Ref, ComponentInternalInstance } from 'vue';
|
||||
import type { Emitter } from '/@/utils/mitt';
|
||||
import { createContext, useContext } from '/@/hooks/core/useContext';
|
||||
|
||||
export type MenuEmitterEvents = {
|
||||
'on-update-opened':
|
||||
| (string | number)[]
|
||||
| {
|
||||
opend: boolean;
|
||||
parent?: ComponentInternalInstance | null;
|
||||
uidList: number[];
|
||||
};
|
||||
'on-menu-item-select': string | number;
|
||||
'open-name-change': {
|
||||
name: string | number;
|
||||
opened: boolean;
|
||||
};
|
||||
'on-update-active-name:submenu': number[];
|
||||
};
|
||||
|
||||
export interface SimpleRootMenuContextProps {
|
||||
rootMenuEmitter: Emitter;
|
||||
rootMenuEmitter: Emitter<MenuEmitterEvents>;
|
||||
activeName: Ref<string | number>;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user