Ionic 无法使用iOS上的背景手动解除离子加载

7lrncoxx  于 8个月前  发布在  Ionic
关注(0)|答案(1)|浏览(89)

我使用离子v7与Angular和我不能使用LoadingController提供的backdropDismiss属性。我已经测试了浏览器上的行为,Android和iOS和错误行为只存在于iOS。LoadingController被注入到服务中并从服务中消耗。下面是一个最小的代码:

import { inject, Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';

@Injectable()
export class MyTestService {
  private readonly loadingController = inject(LoadingController);

  showLoading(): void {
    const loadingController = this.loadingController.create({
      message: 'loading',
      spinner: 'dots',
      showBackdrop: true,
      backdropDismiss: true,
    }).then((element) => void element.present());
  }
}

字符串
我怎样才能实现默认的ionic背景行为,就像它在android和web中一样?我已经尝试过为ion-loading设置一个自定义css类,因为它是作为较低版本ionic的解决方案提供的,但是它没有帮助。
components.scss:

ion-loading.backdrop-workaround {
  --height: auto;
}


然后将自定义类添加到我的加载示例中:

const loadingController = this.loadingController.create({
      message: 'loading',
      spinner: 'dots',
      showBackdrop: true,
      backdropDismiss: true,
      cssClass: 'backdrop-workaround',  // did not help for iOS
    });

scyqe7ek

scyqe7ek1#

这个问题与LoadingController有关。当我切换到inline方法时,background工作了。
样本可从文档中获取:

<ion-button id="open-loading">Show Loading</ion-button>
<ion-loading trigger="open-loading" message="loading"></ion-loading>

字符串

相关问题