Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 离子4离子行动控制器防止自动关闭按钮点击_Ionic Framework_Ionic4 - Fatal编程技术网

Ionic framework 离子4离子行动控制器防止自动关闭按钮点击

Ionic framework 离子4离子行动控制器防止自动关闭按钮点击,ionic-framework,ionic4,Ionic Framework,Ionic4,我正试图将可用语言列表显示为操作表。但只要按下语言按钮,行动表就会自动关闭。是否有任何可能的方法防止点击ActionSheet按钮自动关闭ion action sheet控制器 async showChangeLangAlert() { const actionSheet = await this.actionSheet.create( { header: this.translateText('Select language'), butto

我正试图将可用语言列表显示为操作表。但只要按下语言按钮,行动表就会自动关闭。是否有任何可能的方法防止点击ActionSheet按钮自动关闭ion action sheet控制器

async showChangeLangAlert() {
    const actionSheet = await this.actionSheet.create(
      {
        header: this.translateText('Select language'),
        buttons: this.getLanguageInputTypes(),
        cssClass: 'confirmation-popup select-lang',
        backdropDismiss: true,
        mode: 'md'
      }
    );

    actionSheet.present();

    actionSheet.onWillDismiss().then(res => {
      console.log(res);
      event.preventDefault();
    });

    actionSheet.onDidDismiss().then(res => {
      this.langChoosen.next(this.selectedLanguage);
    });
  }

private getLanguageInputTypes(): ActionSheetButton[] {
    if (this.selectedLanguage === undefined) {
      this.selectedLanguage = 'en';
    }
    return [
      {
        text: this.translateText('English'),
        icon: (this.selectedLanguage.toLowerCase() === 'en') ? 'radio-button-on' : 'radio-button-off',
        cssClass: (this.selectedLanguage.toLowerCase() === 'en') ? 'active-option' : '',
        handler: () => {
          this.selectedLanguage = 'en';
        }
      },
      {
        text: this.translateText('German'),
        icon: (this.selectedLanguage.toLowerCase() === 'de') ? 'radio-button-on' : 'radio-button-off',
        cssClass: (this.selectedLanguage.toLowerCase() === 'de') ? 'active-option' : '',
        handler: () => {
          this.selectedLanguage = 'de';
        }
      },
      {
        text: this.translateText('Select'),
        icon: 'checkmark-circle',
        cssClass: (this.selectedLanguage.toLowerCase() === 'de') ? 'active-option' : '',
        handler: () => {
          this.setSelectedLanguage();
        }
      }
        ];
      }

private setSelectedLanguage() {
 // close the action-sheet here
}
我想实现手动关闭动作表控制器,但它会在单击任何动作按钮时自动关闭。我遗漏了什么,或者是否有任何解决方法可以将警报窗口显示为操作表

backdrops 描述 如果为true,则单击背景时将取消操作表

属性背景消除 类型布尔 默认为真

backdropDismiss:false

您能告诉我为什么要这样做吗?
backdropdisclesh:false
将此作为属性传递。我使用警报控制器和自定义动画达到了所需的效果。@Najamusaqib backdropdisclesh用于通过单击它外部关闭模式窗口如果您不再寻找答案,则可以删除此问题