props.ts 1.2 KB
Newer Older
陈文彬 已提交
1 2 3
import type { Menu } from '/@/router/types';
import type { PropType } from 'vue';

V
vben 已提交
4 5
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
import { ThemeEnum } from '/@/enums/appEnum';
V
vben 已提交
6
import { propTypes } from '/@/utils/propTypes';
陈文彬 已提交
7 8 9 10 11
export const basicProps = {
  items: {
    type: Array as PropType<Menu[]>,
    default: () => [],
  },
V
vben 已提交
12
  appendClass: propTypes.bool,
V
vben 已提交
13

V
vben 已提交
14
  collapsedShowTitle: propTypes.bool,
V
vben 已提交
15

陈文彬 已提交
16
  // 最好是4 倍数
V
vben 已提交
17
  inlineIndent: propTypes.number.def(20),
陈文彬 已提交
18 19
  // 菜单组件的mode属性
  mode: {
V
vben 已提交
20
    type: String as PropType<MenuModeEnum>,
陈文彬 已提交
21 22
    default: MenuModeEnum.INLINE,
  },
V
vben 已提交
23
  showLogo: propTypes.bool,
陈文彬 已提交
24 25 26 27
  type: {
    type: String as PropType<MenuTypeEnum>,
    default: MenuTypeEnum.MIX,
  },
V
vben 已提交
28 29
  theme: propTypes.string.def(ThemeEnum.DARK),
  inlineCollapsed: propTypes.bool,
V
vben 已提交
30

V
vben 已提交
31 32
  isHorizontal: propTypes.bool,
  accordion: propTypes.bool.def(true),
陈文彬 已提交
33
  beforeClickFn: {
V
vben 已提交
34
    type: Function as PropType<(key: string) => Promise<boolean>>,
陈文彬 已提交
35 36
  },
};
V
vben 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49

export const itemProps = {
  item: {
    type: Object as PropType<Menu>,
    default: {},
  },
  level: propTypes.number,
  theme: propTypes.oneOf(['dark', 'light']),
  appendClass: propTypes.bool,
  parentPath: propTypes.string,
  showTitle: propTypes.bool,
  isHorizontal: propTypes.bool,
};