mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
docs(overlays): add usage by framework
This commit is contained in:
@ -13,21 +13,6 @@ Loading indicators can be created using a [Loading Controller](../../loading-con
|
||||
The loading indicator can be dismissed automatically after a specific amount of time by passing the number of milliseconds to display it in the `duration` of the loading options. By default the loading indicator will show even during page changes, but this can be disabled by setting `dismissOnPageChange` to `true`. To dismiss the loading indicator after creation, call the `dismiss()` method on the loading instance. The `onDidDismiss` function can be called to perform an action after the loading indicator is dismissed.
|
||||
|
||||
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loadingController = document.querySelector('ion-loading-controller');
|
||||
await loadingController.componentOnReady();
|
||||
|
||||
const loadingElement = await loadingController.create({
|
||||
content: 'Please wait...',
|
||||
spinner: 'crescent',
|
||||
duration: 2000
|
||||
});
|
||||
return await loadingElement.present();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
<!-- Auto Generated Below -->
|
||||
|
||||
|
||||
|
||||
34
core/src/components/loading/usage/angular.md
Normal file
34
core/src/components/loading/usage/angular.md
Normal file
@ -0,0 +1,34 @@
|
||||
```javascript
|
||||
import { Component } from '@angular/core';
|
||||
import { LoadingController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'loading-example',
|
||||
templateUrl: 'loading-example.html',
|
||||
styleUrls: ['./loading-example.css'],
|
||||
})
|
||||
export class LoadingExample {
|
||||
|
||||
constructor(public loadingController: LoadingController) {}
|
||||
|
||||
presentLoading() {
|
||||
const loading = this.loadingController.create({
|
||||
message: 'Hellooo',
|
||||
duration: 2000
|
||||
});
|
||||
loading.present();
|
||||
}
|
||||
|
||||
presentLoadingWithOptions() {
|
||||
const loading = this.loadingController.create({
|
||||
spinner: 'hide',
|
||||
duration: 5000,
|
||||
content: 'Please wait...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading'
|
||||
});
|
||||
loading.present();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
26
core/src/components/loading/usage/javascript.md
Normal file
26
core/src/components/loading/usage/javascript.md
Normal file
@ -0,0 +1,26 @@
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loadingController = document.querySelector('ion-loading-controller');
|
||||
await loadingController.componentOnReady();
|
||||
|
||||
const loading = await loadingController.create({
|
||||
message: 'Hellooo',
|
||||
duration: 2000
|
||||
});
|
||||
return await loading.present();
|
||||
}
|
||||
|
||||
async function presentLoadingWithOptions() {
|
||||
const loadingController = document.querySelector('ion-loading-controller');
|
||||
await loadingController.componentOnReady();
|
||||
|
||||
const loading = await loadingController.create({
|
||||
spinner: 'hide',
|
||||
duration: 5000,
|
||||
content: 'Please wait...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading'
|
||||
});
|
||||
return await loading.present();
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user