mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
25 lines
763 B
TypeScript
25 lines
763 B
TypeScript
import { buildProps, definePropType } from '@element-plus/utils/props'
|
|
import { isString } from '@element-plus/utils/util'
|
|
|
|
import type { ExtractPropTypes } from 'vue'
|
|
import type { RouteLocationRaw } from 'vue-router'
|
|
import type { MenuItemRegistered } from './types'
|
|
|
|
export const menuItemProps = buildProps({
|
|
index: {
|
|
type: definePropType<string | null>([String, null]),
|
|
default: null,
|
|
},
|
|
route: {
|
|
type: definePropType<RouteLocationRaw>([String, Object]),
|
|
},
|
|
disabled: Boolean,
|
|
} as const)
|
|
export type MenuItemProps = ExtractPropTypes<typeof menuItemProps>
|
|
|
|
export const menuItemEmits = {
|
|
click: (item: MenuItemRegistered) =>
|
|
isString(item.index) && Array.isArray(item.indexPath),
|
|
}
|
|
export type MenuItemEmits = typeof menuItemEmits
|