Skip to content

Commit 66ccc52

Browse files
anlyyaonovlan1
andauthored
fix(Input): the change event is invalid for skyline and type = 'nickname' (#3858)
* fix(Input): the change event is invalid for skyline and type = 'nickname' * test: update snapshots --------- Co-authored-by: novlan1 <[email protected]>
1 parent b4457cd commit 66ccc52

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

packages/components/input/__test__/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ exports[`input props : clearable && label && suffix 1`] = `
6060
type="text"
6161
value="input输入框"
6262
bind:blur="onBlur"
63+
bind:change="onChange"
6364
bind:confirm="onConfirm"
6465
bind:focus="onFocus"
6566
bind:input="onInput"
@@ -193,6 +194,7 @@ exports[`input slots : label 1`] = `
193194
type="text"
194195
value=""
195196
bind:blur="onBlur"
197+
bind:change="onChange"
196198
bind:confirm="onConfirm"
197199
bind:focus="onFocus"
198200
bind:input="onInput"

packages/components/input/input.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ export default class Input extends SuperComponent {
104104
this.triggerEvent('change', { value: this.data.value, cursor, keyCode });
105105
},
106106

107+
onChange(e) {
108+
if (this.properties.type !== 'nickname') return;
109+
const { value } = e.detail;
110+
this.updateValue(value);
111+
this.triggerEvent('change', { value: this.data.value });
112+
},
113+
107114
onFocus(e) {
108115
this.updateClearIconVisible(true);
109116
this.triggerEvent('focus', e.detail);

packages/components/input/input.wxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
aria-label="{{label}}"
5858
aria-roledescription="{{label}}"
5959
bindinput="onInput"
60+
bindchange="onChange"
6061
bindfocus="onFocus"
6162
bindblur="onBlur"
6263
bindconfirm="onConfirm"

0 commit comments

Comments
 (0)