refactor(components): [popper]redfine the prop role type (#9471)

* refactor(components): [popper]redfine the prop role type

* chore: remove unnecessary code

* refactor(components): [popper]update variable name
This commit is contained in:
MonsterPi 2022-08-26 20:46:25 +08:00 committed by GitHub
parent 27e447b3ca
commit 5c8c369594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import { buildProps } from '@element-plus/utils'
import type { ExtractPropTypes, PropType } from 'vue'
import type { ExtractPropTypes } from 'vue'
const effects = ['light', 'dark'] as const
const triggers = ['click', 'contextmenu', 'hover', 'focus'] as const
@ -8,16 +8,24 @@ const triggers = ['click', 'contextmenu', 'hover', 'focus'] as const
export const Effect = {
LIGHT: 'light',
DARK: 'dark',
}
} as const
export const roleTypes = [
'dialog',
'grid',
'listbox',
'menu',
'tooltip',
'tree',
] as const
export type PopperEffect = typeof effects[number]
export type PopperTrigger = typeof triggers[number]
export const usePopperProps = buildProps({
role: {
type: String as PropType<
'dialog' | 'grid' | 'listbox' | 'menu' | 'tooltip' | 'tree'
>,
type: String,
values: roleTypes,
default: 'tooltip',
},
} as const)