diff --git a/src/field/README.zh-CN.md b/src/field/README.zh-CN.md
index feba7015e..8a22b9f12 100644
--- a/src/field/README.zh-CN.md
+++ b/src/field/README.zh-CN.md
@@ -45,9 +45,9 @@ export default {
-
+
-
+
diff --git a/src/field/index.js b/src/field/index.js
index 849611bb8..12c37c6d7 100644
--- a/src/field/index.js
+++ b/src/field/index.js
@@ -1,6 +1,5 @@
// Utils
import { formatNumber } from './utils';
-import { isIOS } from '../utils/validate/system';
import { preventDefault } from '../utils/dom/event';
import { resetScroll } from '../utils/dom/reset-scroll';
import {
@@ -419,24 +418,21 @@ export default createComponent({
}
let inputType = type;
+ let inputMode;
- // type="number" is weired in iOS
+ // type="number" is weired in iOS, and can't prevent dot in Android
+ // so use inputmode to set keyboard in mordern browers
if (type === 'number') {
inputType = 'text';
+ inputMode = 'decimal';
}
if (type === 'digit') {
- // set pattern to show number keyboard in iOS
- if (isIOS()) {
- inputType = 'number';
- inputProps.attrs.pattern = '\\d*';
- // cannot prevent dot when type is number in Android, so use tel
- } else {
- inputType = 'tel';
- }
+ inputType = 'tel';
+ inputMode = 'numeric';
}
- return ;
+ return ;
},
genLeftIcon() {
diff --git a/src/field/test/__snapshots__/demo.spec.js.snap b/src/field/test/__snapshots__/demo.spec.js.snap
index 9db4863cc..4c8bb4137 100644
--- a/src/field/test/__snapshots__/demo.spec.js.snap
+++ b/src/field/test/__snapshots__/demo.spec.js.snap
@@ -27,13 +27,13 @@ exports[`renders demo correctly 1`] = `