Skip to content

Commit 4ea00d3

Browse files
committed
fix: select option not support click event
1 parent 520d6a5 commit 4ea00d3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

antdv-demo

components/vc-select/OptionList.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,22 @@ const OptionList = defineComponent<OptionListProps, { state?: any }>({
356356
aria-selected={selected}
357357
class={optionClassName}
358358
title={optionTitle}
359-
onMousemove={() => {
359+
onMousemove={e => {
360+
if (otherProps.onMousemove) {
361+
otherProps.onMousemove(e);
362+
}
360363
if (activeIndex === itemIndex || disabled) {
361364
return;
362365
}
363366
setActive(itemIndex);
364367
}}
365-
onClick={() => {
368+
onClick={e => {
366369
if (!disabled) {
367370
onSelectValue(value);
368371
}
372+
if (otherProps.onClick) {
373+
otherProps.onClick(e);
374+
}
369375
}}
370376
style={style}
371377
>

components/vc-select/utils/legacyUtil.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function convertNodeToOption(node: VNode): OptionData {
1010
} = node as VNode & {
1111
children: { default?: () => any };
1212
};
13-
const child = children.default ? children.default() : undefined;
13+
const child = children && children.default ? children.default() : undefined;
1414
return {
1515
key,
1616
value: value !== undefined ? value : key,
@@ -43,7 +43,7 @@ export function convertChildrenToData(
4343
if (optionOnly || !isSelectOptGroup) {
4444
return convertNodeToOption(node);
4545
}
46-
const child = children.default ? children.default() : undefined;
46+
const child = children && children.default ? children.default() : undefined;
4747
return {
4848
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
4949
label: key,

0 commit comments

Comments
 (0)