@@ -2,7 +2,7 @@ import TransBtn from '../TransBtn';
2
2
import type { InnerSelectorProps } from './interface' ;
3
3
import Input from './Input' ;
4
4
import type { Ref , PropType } from 'vue' ;
5
- import { ref , watchEffect , computed , defineComponent , onMounted , shallowRef , watch } from 'vue' ;
5
+ import { computed , defineComponent , onMounted , shallowRef , watch } from 'vue' ;
6
6
import classNames from '../../_util/classNames' ;
7
7
import pickAttrs from '../../_util/pickAttrs' ;
8
8
import PropTypes from '../../_util/vue-types' ;
@@ -93,14 +93,10 @@ const SelectSelector = defineComponent<SelectorProps>({
93
93
( ) =>
94
94
props . mode === 'tags' || ( ( props . showSearch && ( props . open || focused . value ) ) as boolean ) ,
95
95
) ;
96
- const targetValue = ref ( '' ) ;
97
- watchEffect ( ( ) => {
98
- targetValue . value = inputValue . value ;
99
- } ) ;
100
96
// We measure width and set to the input immediately
101
97
onMounted ( ( ) => {
102
98
watch (
103
- targetValue ,
99
+ inputValue ,
104
100
( ) => {
105
101
inputWidth . value = measureRef . value . scrollWidth ;
106
102
} ,
@@ -207,14 +203,6 @@ const SelectSelector = defineComponent<SelectorProps>({
207
203
return defaultRenderSelector ( content , content , false ) ;
208
204
}
209
205
210
- const handleInput = ( e : Event ) => {
211
- const composing = ( e . target as any ) . composing ;
212
- targetValue . value = ( e . target as any ) . value ;
213
- if ( ! composing ) {
214
- props . onInputChange ( e ) ;
215
- }
216
- } ;
217
-
218
206
return ( ) => {
219
207
const {
220
208
id,
@@ -229,6 +217,7 @@ const SelectSelector = defineComponent<SelectorProps>({
229
217
activeDescendantId,
230
218
tabindex,
231
219
compositionStatus,
220
+ onInputChange,
232
221
onInputPaste,
233
222
onInputKeyDown,
234
223
onInputMouseDown,
@@ -253,10 +242,10 @@ const SelectSelector = defineComponent<SelectorProps>({
253
242
autocomplete = { autocomplete }
254
243
editable = { inputEditable . value }
255
244
activeDescendantId = { activeDescendantId }
256
- value = { targetValue . value }
245
+ value = { inputValue . value }
257
246
onKeydown = { onInputKeyDown }
258
247
onMousedown = { onInputMouseDown }
259
- onChange = { handleInput }
248
+ onChange = { onInputChange }
260
249
onPaste = { onInputPaste }
261
250
onCompositionstart = { onInputCompositionStart }
262
251
onCompositionend = { onInputCompositionEnd }
@@ -268,7 +257,7 @@ const SelectSelector = defineComponent<SelectorProps>({
268
257
269
258
{ /* Measure Node */ }
270
259
< span ref = { measureRef } class = { `${ selectionPrefixCls . value } -search-mirror` } aria-hidden >
271
- { targetValue . value }
260
+ { inputValue . value }
272
261
</ span >
273
262
</ div >
274
263
) ;
0 commit comments