[英]Create input with type number in alert - Ionic
有沒有一種方法可以在Alert(AlertController)中創建帶有類型編號的輸入
我嘗試寫這個,但是輸入正在使用文本類型,沒有數字
const alert = this.alertCtrl.create({
title: 'add Ingredient',
inputs: [
{
name: 'name',
placeholder: 'name'
},
{
name: 'amount',
placeholder: 'amount',
type: 'number' // here the error
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel'
}
]
});
添加完present()后,我便檢查了您的代碼及其工作情況。
所以它看起來像這樣:
const alert = this.alertCtrl.create({
title: 'add Ingredient',
inputs: [
{
name: 'name',
placeholder: 'name'
},
{
name: 'amount',
placeholder: 'amount',
type: 'number' // here the error
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel'
}
]
});
alert.present();
一旦添加它,我就可以看到警報,並且輸入僅限於數字。 數字鍵盤也應顯示在移動設備上。
Ionic文檔在這里對此進行了更詳細的介紹。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.