element-plus/packages/components/select-v2/src/useOption.ts

17 lines
346 B
TypeScript
Raw Normal View History

import type { IOptionProps } from './token'
export function useOption(props: IOptionProps, { emit }) {
return {
hoverItem: () => {
if (!props.disabled) {
emit('hover', props.index)
}
},
selectOptionClick: () => {
if (!props.disabled) {
emit('select', props.item, props.index)
}
},
}
}