Skip to content

Commit

Permalink
feat(input): support input nickname event (#5758)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonwong666 committed Apr 12, 2024
1 parent 348c310 commit 979fc92
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/cascader/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -187,6 +188,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -298,6 +300,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -409,6 +412,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
4 changes: 4 additions & 0 deletions packages/config-provider/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -300,6 +301,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -544,6 +546,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -661,6 +664,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
3 changes: 2 additions & 1 deletion packages/field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Page({
| label | 输入框左侧文本 | _string_ | - |
| size | 单元格大小,可选值为 `large` | _string_ | - |
| value | 当前输入的值 | _string \| number_ | - |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` | _string_ | `text` |
| type | 可设置为任意原生类型, 如 `number` `idcard` `textarea` `digit` `nickname` | _string_ | `text` |
| fixed | 如果 type 为 `textarea` 且在一个 `position:fixed` 的区域,需要显示指定属性 fixed 为 true | _boolean_ | `false` |
| focus | 获取焦点 | _boolean_ | `false` |
| border | 是否显示内边框 | _boolean_ | `true` |
Expand Down Expand Up @@ -309,6 +309,7 @@ Page({
| bind:click-input | 点击输入区域时触发 | - |
| bind:linechange | 输入框行数变化时调用,只对 textarea 有效 | event.detail = { height: 0, heightRpx: 0, lineCount: 0 } |
| bind:keyboardheightchange | 键盘高度发生变化的时候触发此事件 | event.detail = { height: height, duration: duration } |
| bind:nicknamereview `v1.11.5` | 用户昵称审核完毕后触发,仅在 type 为 "nickname" 时有效 | event.detail = { pass, timeout } |

### InputDetail

Expand Down
4 changes: 4 additions & 0 deletions packages/field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ VantComponent({
this.$emit('keyboardheightchange', event.detail);
},

onBindNicknameReview(event) {
this.$emit('nicknamereview', event.detail);
},

emitChange(detail: InputDetails) {
const { extraEventParams } = this.data;

Expand Down
1 change: 1 addition & 0 deletions packages/field/input.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
bindfocus="onFocus"
bindconfirm="onConfirm"
bindkeyboardheightchange="onKeyboardHeightChange"
bindnicknamereview="onBindNicknameReview"
/>
8 changes: 8 additions & 0 deletions packages/field/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -163,6 +164,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -250,6 +252,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -353,6 +356,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -446,6 +450,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -522,6 +527,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -623,6 +629,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -814,6 +821,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down
6 changes: 6 additions & 0 deletions packages/search/test/__snapshots__/demo.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -203,6 +204,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -322,6 +324,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -429,6 +432,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -536,6 +540,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down Expand Up @@ -650,6 +655,7 @@ exports[`should render demo and match snapshot 1`] = `
bind:focus="onFocus"
bind:input="onInput"
bind:keyboardheightchange="onKeyboardHeightChange"
bind:nicknamereview="onBindNicknameReview"
bind:tap="onClickInput"
/>
<wx-view
Expand Down

0 comments on commit 979fc92

Please sign in to comment.