当我想要设置新的loadingController时,LoadingOption出错

loading...


0

嗨,我是Ionic的新手,当我想要创建新的loadingScreen时,我有这个错误 .

Argument of type '{ content: string; }' is not assignable to parameter 
of type 'LoadingOptions'.
Object literal may only specify known properties, and 'content' does not exist in type 'LoadingOptions'.

我看documentation,我觉得语法很好 .

const loading = await this.loadingController.create({
        content: 'Please wait...',
    });
    await loading.present();

loading...

1回答

  • 0

    看起来他们的文档已经过时,这里是他们代码中的接口定义:

    https://github.com/ionic-team/ionic/blob/master/core/src/components/loading/loading-interface.ts

    export interface LoadingOptions {
      spinner?: SpinnerTypes | null;
      message?: string;
      cssClass?: string | string[];
      showBackdrop?: boolean;
      duration?: number;
      translucent?: boolean;
      animated?: boolean;
    
      mode?: Mode;
      keyboardClose?: boolean;
      id?: string;
    
      enterAnimation?: AnimationBuilder;
      leaveAnimation?: AnimationBuilder;
    }
    

    如您所见,没有 content ,它已被重命名为 message .

评论

暂时没有评论!