mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* chore: remove ts-nocheck comments in select-v2 * take the review comments * improve emits type * the keys of emits use camelCase instead of kebab-case * apply suggestions from code review Co-authored-by: btea <2356281422@qq.com> * reduce duplicate ESLint comments * use more succinct syntax to define props * revert emits to kebab-case * fix: type checking failed * chore: illustrate why return early in validateIcon * fix: signature with duplicate parameter names Co-authored-by: qiang <qw13131wang@gmail.com> --------- Co-authored-by: btea <2356281422@qq.com> Co-authored-by: qiang <qw13131wang@gmail.com>
21 lines
427 B
TypeScript
21 lines
427 B
TypeScript
import type { IOptionV2Props } from './token'
|
|
import type { OptionEmitFn } from './defaults'
|
|
|
|
export function useOption(
|
|
props: IOptionV2Props,
|
|
{ emit }: { emit: OptionEmitFn }
|
|
) {
|
|
return {
|
|
hoverItem: () => {
|
|
if (!props.disabled) {
|
|
emit('hover', props.index)
|
|
}
|
|
},
|
|
selectOptionClick: () => {
|
|
if (!props.disabled) {
|
|
emit('select', props.item, props.index)
|
|
}
|
|
},
|
|
}
|
|
}
|