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

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

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