mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
20 lines
399 B
TypeScript
20 lines
399 B
TypeScript
import type { OptionV2EmitFn, OptionV2Props } from './defaults'
|
|
|
|
export function useOption(
|
|
props: OptionV2Props,
|
|
{ emit }: { emit: OptionV2EmitFn }
|
|
) {
|
|
return {
|
|
hoverItem: () => {
|
|
if (!props.disabled) {
|
|
emit('hover', props.index)
|
|
}
|
|
},
|
|
selectOptionClick: () => {
|
|
if (!props.disabled) {
|
|
emit('select', props.item, props.index)
|
|
}
|
|
},
|
|
}
|
|
}
|