ユーザインタラクションをブロックしながらアクティビティを示すためのオーバーレイです。ローディング・インジケータはアプリのコンテンツの上に表示され、ユーザーの操作を再開するために消すことができます。オプションでbackdropが含まれており、showBackdrop: false で無効にすることができます。
基本的な使い方 一度表示されると、ロードインジケータはデフォルトで無期限に表示されます。開発者は、コンポーネント上で dismiss() メソッドを呼び出すことで、作成後にローディングインジケータを手動で解除することができます。onDidDismiss 関数を呼び出すと、ローディングインジケータが解除された後にアクションを実行することができます。
また、ロードオプションの duration に表示するミリ秒数を渡すことで、特定の時間が経過した後にロードインジケータを自動的に解除するよう設定することもできます。
インラインロード (推奨) html src/app/example.component.html example.component.html ts src/app/example.component.ts example.component.ts
< ion-button id = " open-loading " > Show Loading </ ion-button >
< ion-loading trigger = " open-loading " message = " Dismissing after 3 seconds... " duration = " 3000 " > </ ion-loading > Controller html src/app/example.component.html example.component.html ts src/app/example.component.ts example.component.ts
< ion-button (click) = " showLoading() " > Show Loading </ ion-button > カスタマイズ スピナー html src/app/example.component.html example.component.html ts src/app/example.component.ts example.component.ts
< ion-button id = " open-loading " > Show Loading </ ion-button >
< ion-loading trigger = " open-loading " message = " Loading... " [duration] = " 3000 " spinner = " circles " > </ ion-loading > テーマ Loading は scoped encapsulation を使用しています。これは、実行時に各スタイルに追加のクラスを付加することで、自動的に CSS をスコープ化することを意味します。CSSでscopedセレクタをオーバーライドするには、higher specificity セレクタが必要です。
カスタムクラスを渡して、それを使ってホストと内部要素にカスタムスタイルを追加することをお勧めします。
html src/app/example.component.html example.component.html ts src/app/example.component.ts example.component.ts css src/global.css global.css
< ion-button id = " open-loading " > Show Loading </ ion-button >
< ion-loading class = " custom-loading " trigger = " open-loading " message = " Loading... " [duration] = " 3000 " > </ ion-loading > 注記
ion-loading is presented at the root of your application, so we recommend placing any ion-loading styles in a global stylesheet.
アクセシビリティ Ionicは自動的にLoadingのroleをdialog に設定します。
Loadingにmessageプロパティが定義されている場合、aria-labelledby属性は自動的にmessage要素のIDに設定されます。そうでない場合、aria-labelledbyは設定されず、開発者は htmlAttributes プロパティを使用して aria-label を提供する必要があります。
すべてのARIA属性は、LoadingのhtmlAttributesプロパティにカスタム値を定義することによって、手動で上書きすることができます。
Interfaces LoadingOptions interface LoadingOptions {
spinner ? : SpinnerTypes | null ;
message ? : string | IonicSafeString ;
cssClass ? : string | string [ ] ;
showBackdrop ? : boolean ;
duration ? : number ;
translucent ? : boolean ;
animated ? : boolean ;
backdropDismiss ? : boolean ;
mode ? : Mode ;
keyboardClose ? : boolean ;
id ? : string ;
htmlAttributes ? : { [ key : string ] : any } ;
enterAnimation ? : AnimationBuilder ;
leaveAnimation ? : AnimationBuilder ;
} プロパティ animated Description trueの場合、ロードインジケータをアニメーションで表示します。Attribute animatedType booleanDefault true
backdropDismiss Description trueの場合、バックドロップがクリックされたときにローディングインジケータが解除される。Attribute backdrop-dismissType booleanDefault false
cssClass Description カスタムCSSに適用する追加のクラス。複数のクラスを指定する場合は、スペースで区切る必要があります。 Attribute css-classType string | string[] | undefinedDefault undefined
duration Description ローディングインジケータを解除するまでの待ち時間(ミリ秒)。 Attribute durationType numberDefault 0
enterAnimation Description ローディングインジケータが表示されたときに使用するアニメーションです。 Attribute enter-animationType ((baseEl: any, opts?: any) => Animation) | undefinedDefault undefined
htmlAttributes Description ローダーに渡す追加属性。 Attribute html-attributesType undefined | { [key: string]: any; }Default undefined
isOpen Description trueの場合、ローディングインジケータは開きます。falseの場合、ローディングインジケータは閉じます。より細かく表示を制御したい場合に使用します。そうでない場合は、loadingController または trigger プロパティを使用してください。注意: ローディングインジケータが終了しても、isOpenは自動的に falseに戻されません。あなたのコードでそれを行う必要があります。Attribute is-openType booleanDefault false
keyboardClose Description trueの場合、オーバーレイが表示されたときにキーボードが自動的に解除されます。Attribute keyboard-closeType booleanDefault true
leaveAnimation Description ローディングインジケータが解除されたときに使用するアニメーションです。 Attribute leave-animationType ((baseEl: any, opts?: any) => Animation) | undefinedDefault undefined
message Description ローディングインジケータに表示するテキストコンテンツを任意で指定します。 このプロパティは、文字列としてカスタムHTMLを受け入れます。コンテンツはデフォルトでプレーンテキストとしてパースされます。カスタムHTMLを使用するには、Ionicの設定で innerHTMLTemplatesEnabled を true に設定する必要があります。 Attribute messageType IonicSafeString | string | undefinedDefault undefined
mode Description modeは、どのプラットフォームのスタイルを使用するかを決定します。 This is a virtual property that is set once during initialization and will not update if you change its value after the initial render. Attribute modeType "ios" | "md"Default undefined
showBackdrop Description trueの場合、ロードインジケータの後ろにバックドロップが表示されます。Attribute show-backdropType booleanDefault true
spinner Description 表示するスピナーの名前。 Attribute spinnerType "bubbles" | "circles" | "circular" | "crescent" | "dots" | "lines" | "lines-sharp" | "lines-sharp-small" | "lines-small" | null | undefinedDefault undefined
translucent Description trueの場合、ロードインジケータは半透明になります。modeが "ios" で、デバイスが backdrop-filter をサポートしている場合にのみ適用されます。Attribute translucentType booleanDefault false
trigger Description クリックするとローディングインジケータが開くトリガー要素に対応するIDです。 Attribute triggerType string | undefinedDefault undefined
イベント Name Description Bubbles didDismissローディングインジケータが解除された後に発行されます。ionLoadingDidDismissの略記。 truedidPresentローディングインジケータが提示された後に放出される。ionLoadingWillDismissの略記。 trueionLoadingDidDismissローディングが解除された後に発行されます。 trueionLoadingDidPresentローディングが提示された後に発行されます。 trueionLoadingWillDismissローディングが解除される前に発行されます。 trueionLoadingWillPresentローディングが提示される前に発行されます。 truewillDismissローディングインジケータが解散する前に発行されます。ionLoadingWillDismissの略記です。 truewillPresentローディングインジケータが提示される前に発行されます。ionLoadingWillPresentの略記。 true
メソッド dismiss Description ローディングのオーバーレイが表示された後に閉じます。オーバーレイがまだ表示されていない場合は何もしません。表示されなかったオーバーレイを DOM から削除するには、remove メソッドを使用してください。 Signature dismiss(data?: any, role?: string) => Promise<boolean>Parameters data : Any data to emit in the dismiss events.role : The role of the element that is dismissing the loading. This can be useful in a button handler for determining which button was clicked to dismiss the loading. Some examples include: "cancel", "destructive", "selected", and "backdrop".
onDidDismiss Description ローディングが解除されたタイミングを解決するPromiseを返します。 Signature onDidDismiss<T = any>() => Promise<OverlayEventDetail<T>>
onWillDismiss Description ローディングが解除されるタイミングを解決するPromiseを返します。 Signature onWillDismiss<T = any>() => Promise<OverlayEventDetail<T>>
present Description 作成後のローディングオーバーレイを提示します。 Signature present() => Promise<void>
CSS Shadow Parts No CSS shadow parts available for this component.
CSSカスタムプロパティ iOS MD
Name Description --backdrop-opacity背景の不透明度 --backgroundローディングダイアログの背景 --heightローディングダイアログの高さ --max-heightローディングダイアログの最大の高さ --max-widthローディングダイアログの最大幅 --min-heightローディングダイアログの最小高さ --min-widthローディングダイアログの最小幅 --spinner-colorローディングスピナーの色 --widthローディングダイアログの幅
Slots No slots available for this component.