element-plus
Version:
A Component Library for Vue 3
17 lines (15 loc) • 346 B
text/typescript
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)
}
},
}
}