通过 AlertController 在 Alert Prompt 中 Ionic3 中的复选框

Checkbox in Ionic3 in Alert Prompt via AlertController

我正在尝试使用 Ionic3 的 AlertController 向我的警报提示添加一个复选框。

我试过这样的事情:

presentPrompt(name, flaeche) {
    let alert = this.alertCtrl.create({
      title: 'Parzelle bearbeiten',
      inputs: [
        {
          name: 'name',
          placeholder: name
        },
        {
          name: 'flaeche',
          placeholder: flaeche
        },
        {
          type: 'checkbox',
        label: 'Bespin',
        value: 'value2',
        checked: true
        }
      ],
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          handler: data => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'Login',
          handler: data => {
            console.log("Login ");
          }
        }
      ]
    });
    alert.present();
  }

但是没用。如果你能帮助我,那就太好了。

我猜,根据docs,这是不可能的:(

Alerts can also include several different inputs whose data can be passed back to the app. Inputs can be used as a simple way to prompt users for information. Radios, checkboxes and text inputs are all accepted, but they cannot be mixed. For example, an alert could have all radio button inputs, or all checkbox inputs, but the same alert cannot mix radio and checkbox inputs. Do note however, different types of "text"" inputs can be mixed, such as url, email, text, etc. If you require a complex form UI which doesn't fit within the guidelines of an alert then we recommend building the form within a modal instead.