嗨,我是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();
答案 0 :(得分:2)
看起来他们的文档已经过时,这是其代码中的接口定义:
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
。