vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
49 lines (48 loc) • 919 B
TypeScript
import { Ref } from 'vue';
/**
* Props
*/
export interface Props {
mode?: 'horizontal' | 'vertical';
data: any[];
className?: string;
trigger?: 'hover' | 'click';
theme?: 'light' | 'dark';
selectedKey?: string;
shadow?: boolean;
label?: string;
skey?: string;
}
/**
* ItemProps
*/
export interface ItemProps {
data: any[];
itemUl?: any;
level?: number;
}
/**
* 子集类型
*/
export interface Item {
label?: string;
key?: string;
icon?: string;
children?: Item[];
disabled?: boolean;
className?: string;
}
/**
* 上下文类型
*/
export type MenuContext = {
props: Props;
openKeys: Ref<string[]>;
selectKeys: Ref<string>;
onOpenKeys: (key: string, add: boolean) => void;
onSelectKey: (key: string) => void;
};
export type Emits = {
(event: 'select', item: Item): void;
(event: 'change', item: Item): void;
};