Skip to content

Commit 8b3023e

Browse files
committed
fix: select input not trigger change event
1 parent ecc755b commit 8b3023e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

antdv-demo

components/vc-select/Select.jsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TransitionGroup } from 'vue';
1+
import { TransitionGroup, withDirectives } from 'vue';
22
import KeyCode from '../_util/KeyCode';
33
import PropTypes from '../_util/vue-types';
44
import classnames from '../_util/classNames';
@@ -49,6 +49,7 @@ import contains from '../vc-util/Dom/contains';
4949
import { isIE, isEdge } from '../_util/env';
5050
import isValid from '../_util/isValid';
5151
import { getDataAndAriaProps } from '../_util/util';
52+
import antInput from '../_util/antInputDirective';
5253

5354
const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY';
5455

@@ -639,7 +640,7 @@ const Select = {
639640
if (value.length) {
640641
hidden = true;
641642
}
642-
if (value.length === 1 && state._value && !isValid(state._value[0])) {
643+
if (isCombobox(props) && value.length === 1 && state._value && !isValid(state._value[0])) {
643644
hidden = false;
644645
}
645646
const placeholder = props.placeholder;
@@ -781,18 +782,13 @@ const Select = {
781782
// Add space to the end of the inputValue as the width measurement tolerance
782783
return (
783784
<div class={`${props.prefixCls}-search__field__wrap`} onClick={this.inputClick}>
784-
{cloneElement(inputElement, {
785+
{cloneElement(withDirectives(inputElement, [[antInput]]), {
785786
disabled: props.disabled,
786787
...(inputElement.props || {}),
787788
disabled: props.disabled,
788789
value: inputValue,
789790
class: inputCls,
790791
ref: this.saveInputRef,
791-
// directives: [
792-
// {
793-
// name: 'ant-input',
794-
// },
795-
// ],
796792
onInput: this.onInputChange,
797793
onKeydown: chaining(
798794
this.onInputKeydown,

0 commit comments

Comments
 (0)