useOption.ts 361 B

1234567891011121314151617
  1. // @ts-nocheck
  2. import type { IOptionProps } from './token'
  3. export function useOption(props: IOptionProps, { emit }) {
  4. return {
  5. hoverItem: () => {
  6. if (!props.disabled) {
  7. emit('hover', props.index)
  8. }
  9. },
  10. selectOptionClick: () => {
  11. if (!props.disabled) {
  12. emit('select', props.item, props.index)
  13. }
  14. },
  15. }
  16. }