未验证 提交 90222ca1 编写于 作者: E eiinu 提交者: GitHub

fix(input): 修复 nickname 类型获取值失败的问题 (#867)

上级 9163a558
......@@ -11,6 +11,7 @@ interface Idata {
number: string
digit: string
tel: string
nickname: string
readonly: string
disabled: string
showIcon: string
......@@ -46,6 +47,7 @@ const InputDemo = () => {
number: '数字',
digit: '整数',
tel: '手机号',
nickname: '昵称',
readonly: '只读',
disabled: '禁用',
icon: '显示图标',
......@@ -83,6 +85,7 @@ const InputDemo = () => {
number: 'Number',
digit: 'Digit',
tel: 'Tel',
nickname: 'Nickname',
readonly: 'Readonly',
disabled: 'Disabled',
icon: 'Show Icon',
......@@ -209,6 +212,13 @@ const InputDemo = () => {
defaultValue={state.tel}
type="tel"
/>
<Input
name="nickname"
label={translated.nickname}
placeholder={translated.nickname}
type="nickname"
onChange={(val) => console.log('onChange', val)}
/>
<h2>{translated.title2}</h2>
<Input
label={translated.text}
......
......@@ -85,6 +85,13 @@ const App = () => {
defaultValue={state.tel}
type="tel"
/>
<Input
name="nickname"
label="昵称"
placeholder="昵称(仅支持小程序)"
type="nickname"
onChange={(val) => console.log('onChange', val)}
/>
</>
)
}
......
......@@ -280,7 +280,7 @@ export const Input: FunctionComponent<
if (maxlength && val.length > Number(maxlength)) {
val = val.slice(0, Number(maxlength))
}
updateValue(getModelValue(), 'onBlur')
updateValue(val, 'onBlur')
onBlur && onBlur(val, event)
}
......
......@@ -282,7 +282,7 @@ export const Input: FunctionComponent<
if (maxlength && val.length > Number(maxlength)) {
val = val.slice(0, Number(maxlength))
}
updateValue(getModelValue(), 'onBlur')
updateValue(val, 'onBlur')
onBlur && onBlur(val, event)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册