OGeek|极客世界-中国程序员成长平台

标题: ios - Angular 2 数字键盘启动 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:20
标题: ios - Angular 2 数字键盘启动

我正在尝试在 IOS 上为我的 Angular 2 应用程序调出数字键盘,但无法获得我想要实现的目标。这是我的代码,请告诉我需要进行哪些更改

<input type="number" minlength="0" inputmode="numeric" pattern="[0-9]*" placeholder="Month" formControlName="month" maxlength="2">

我也尝试过更改输入 type="tel"但没有成功。 我不断收到enter image description here而我正在努力实现enter image description here

这是我遇到的文章,以实现我想要使用但没有运气的东西 http://danielfriesen.name/blog/2013/09/19/input-type-number-and-ios-numeric-keypad/



Best Answer-推荐答案


您的代码完全一样,适用于我在 iOS 10.2 OSX 模拟器上的 Safari 中。这是我的笨蛋

My Plunker

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  template: `<h1>Hello {{name}} <input type="number" minlength="0" inputmode="numeric" pattern="[0-9]*" placeholder="Month" formControlName="month" maxlength="2">
</h1>`
})
export class AppComponent { name = 'Angular'; }

见下文enter image description here

关于ios - Angular 2 数字键盘启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41168879/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4