Ionic 中数字的文本键盘
Text keyboard for a number in Ionic
我的 Ionic 应用程序的模式中有一个输入类型元素:
<ion-input [(ngModel)] = "price" placeholder="Inserisci i crediti" type="number" text-center></ion-input>
可以看到类型是"number",但是iOs设备中显示的键盘是标准的文本键盘;为什么?我的代码有问题吗?
如您在 properties of ion-input 中所见,您需要为其提供输入模式。
inputmode
Description
A hint to the browser for which keyboard to display.
Possible values: "none", "text", "tel", "url", "email", "numeric",
"decimal", and "search".
Attribute
inputmode Type "decimal" | "email" | "none" | "numeric" |
"search" | "tel" | "text" | "url" | undefined
我认为这应该可行:
<ion-input inputmode="numeric" [(ngModel)] = "price" placeholder="Inserisci i crediti" type="number" text-center></ion-input>
我的 Ionic 应用程序的模式中有一个输入类型元素:
<ion-input [(ngModel)] = "price" placeholder="Inserisci i crediti" type="number" text-center></ion-input>
可以看到类型是"number",但是iOs设备中显示的键盘是标准的文本键盘;为什么?我的代码有问题吗?
如您在 properties of ion-input 中所见,您需要为其提供输入模式。
inputmode
Description
A hint to the browser for which keyboard to display. Possible values: "none", "text", "tel", "url", "email", "numeric", "decimal", and "search".
Attribute
inputmode Type "decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url" | undefined
我认为这应该可行:
<ion-input inputmode="numeric" [(ngModel)] = "price" placeholder="Inserisci i crediti" type="number" text-center></ion-input>