未验证 提交 8a8e2169 编写于 作者: liu_zheng_wu's avatar liu_zheng_wu 提交者: GitHub

fix: input 组件 type 为数字类型时唤起键盘与微信不一致 (#880)

上级 eabda81b
......@@ -44,8 +44,8 @@ const InputDemo = () => {
title10: '点击事件',
text: '文本',
password: '密码',
number: '数字',
digit: '整数',
number: '数字(弹出数字键盘)',
digit: '数字(弹出小数点的数字键盘)',
tel: '手机号',
nickname: '昵称',
readonly: '只读',
......@@ -82,8 +82,8 @@ const InputDemo = () => {
title10: 'Click Event',
text: 'Text',
password: 'Password',
number: 'Number',
digit: 'Digit',
number: 'Number(Popup Numeric Keypad)',
digit: 'Digit(Popup Numeric Keypad With Decimal Point)',
tel: 'Tel',
nickname: 'Nickname',
readonly: 'Readonly',
......
......@@ -229,11 +229,10 @@ export const Input: FunctionComponent<
trigger: InputFormatTrigger = 'onChange'
) => {
let val = value
if (type === 'digit' || type === 'tel') {
if (type === 'tel') {
val = formatNumber(val, false, false)
}
if (type === 'number') {
if (['number', 'digit'].includes(type)) {
val = formatNumber(val, true, true)
}
if (type === 'tel' && !formatter) {
......@@ -303,12 +302,9 @@ export const Input: FunctionComponent<
}
const inputType = (type: string) => {
if (type === 'number') {
if (type === 'tel') {
return 'text'
}
if (type === 'digit') {
return 'tel'
}
return type
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册