File tree 2 files changed +17
-9
lines changed
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ export function resolveOnChange(
37
37
return ;
38
38
}
39
39
const event : any = e ;
40
- const originalInputValue = target . value ;
41
40
42
41
if ( e . type === 'click' ) {
43
42
Object . defineProperty ( event , 'target' , {
@@ -48,13 +47,13 @@ export function resolveOnChange(
48
47
} ) ;
49
48
// click clear icon
50
49
//event = Object.create(e);
51
- event . target = target ;
52
- event . currentTarget = target ;
50
+ const currentTarget = target . cloneNode ( true ) ;
51
+
52
+ event . target = currentTarget ;
53
+ event . currentTarget = currentTarget ;
53
54
// change target ref value cause e.target.value should be '' when clear input
54
- target . value = '' ;
55
+ ( currentTarget as any ) . value = '' ;
55
56
onChange ( event ) ;
56
- // reset target ref value
57
- target . value = originalInputValue ;
58
57
return ;
59
58
}
60
59
// Trigger by composition event, this means we need force change the input value
@@ -227,7 +226,11 @@ export default defineComponent({
227
226
if ( props . value === undefined ) {
228
227
stateValue . value = value ;
229
228
} else {
230
- instance . update ( ) ;
229
+ nextTick ( ( ) => {
230
+ if ( inputRef . value . value !== stateValue . value ) {
231
+ instance . update ( ) ;
232
+ }
233
+ } ) ;
231
234
}
232
235
nextTick ( ( ) => {
233
236
callback && callback ( ) ;
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export default defineComponent({
31
31
const formItemContext = useInjectFormItemContext ( ) ;
32
32
const stateValue = ref ( props . value === undefined ? props . defaultValue : props . value ) ;
33
33
const resizableTextArea = ref ( ) ;
34
+ const mergedValue = ref ( '' ) ;
34
35
const { prefixCls, size, direction } = useConfigInject ( 'input' , props ) ;
35
36
const showCount = computed ( ( ) => {
36
37
return ( props . showCount as any ) === '' || props . showCount || false ;
@@ -63,7 +64,11 @@ export default defineComponent({
63
64
if ( props . value === undefined ) {
64
65
stateValue . value = value ;
65
66
} else {
66
- resizableTextArea . value ?. instance . update ?.( ) ;
67
+ nextTick ( ( ) => {
68
+ if ( resizableTextArea . value . textArea . value !== mergedValue . value ) {
69
+ resizableTextArea . value ?. instance . update ?.( ) ;
70
+ }
71
+ } ) ;
67
72
}
68
73
nextTick ( ( ) => {
69
74
callback && callback ( ) ;
@@ -152,7 +157,7 @@ export default defineComponent({
152
157
blur,
153
158
resizableTextArea,
154
159
} ) ;
155
- const mergedValue = ref ( '' ) ;
160
+
156
161
watchEffect ( ( ) => {
157
162
let val = fixControlledValue ( stateValue . value ) as string ;
158
163
if (
You can’t perform that action at this time.
0 commit comments