mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(loading): update usage to fix code errors (#20330)
closes ionic-team/ionic-docs#1200
This commit is contained in:
@@ -34,13 +34,12 @@ export class LoadingExample {
|
||||
|
||||
async presentLoading() {
|
||||
const loading = await this.loadingController.create({
|
||||
message: 'Hellooo',
|
||||
message: 'Please wait...',
|
||||
duration: 2000
|
||||
});
|
||||
await loading.present();
|
||||
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
|
||||
console.log('Loading dismissed!');
|
||||
}
|
||||
|
||||
@@ -48,11 +47,15 @@ export class LoadingExample {
|
||||
const loading = await this.loadingController.create({
|
||||
spinner: null,
|
||||
duration: 5000,
|
||||
message: 'Please wait...',
|
||||
message: 'Click the backdrop to dismiss early...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading'
|
||||
cssClass: 'custom-class custom-loading',
|
||||
backdropDismiss: true
|
||||
});
|
||||
return await loading.present();
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
console.log('Loading dismissed with role:', role);
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -63,27 +66,31 @@ export class LoadingExample {
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loading = document.createElement('ion-loading');
|
||||
loading.message: 'Hellooo',
|
||||
loading.duration: 2000;
|
||||
loading.message = 'Please wait...';
|
||||
loading.duration = 2000;
|
||||
|
||||
document.body.appendChild(loading);
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
|
||||
console.log('Loading dismissed!');
|
||||
}
|
||||
|
||||
function presentLoadingWithOptions() {
|
||||
async function presentLoadingWithOptions() {
|
||||
const loading = document.createElement('ion-loading');
|
||||
|
||||
loading.spinner = null;
|
||||
loading.duration = 5000;
|
||||
loading.message = 'Please wait...';
|
||||
loading.message = 'Click the backdrop to dismiss early...';
|
||||
loading.translucent = true;
|
||||
loading.cssClass = 'custom-class custom-loading';
|
||||
loading.backdropDismiss = true;
|
||||
|
||||
document.body.appendChild(loading);
|
||||
return loading.present();
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
console.log('Loading dismissed with role:', role);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -107,7 +114,7 @@ export const LoadingExample: React.FC = () => {
|
||||
<IonLoading
|
||||
isOpen={showLoading}
|
||||
onDidDismiss={() => setShowLoading(false)}
|
||||
message={'Loading...'}
|
||||
message={'Please wait...'}
|
||||
duration={5000}
|
||||
/>
|
||||
</IonContent>
|
||||
@@ -136,14 +143,14 @@ export default {
|
||||
presentLoading() {
|
||||
return this.$ionic.loadingController
|
||||
.create({
|
||||
message: 'Loading',
|
||||
message: 'Please wait...',
|
||||
duration: this.timeout,
|
||||
})
|
||||
.then(l => {
|
||||
.then(loading => {
|
||||
setTimeout(function() {
|
||||
l.dismiss()
|
||||
loading.dismiss()
|
||||
}, this.timeout)
|
||||
return l.present()
|
||||
return loading.present()
|
||||
})
|
||||
},
|
||||
presentLoadingWithOptions() {
|
||||
@@ -151,15 +158,16 @@ export default {
|
||||
.create({
|
||||
spinner: null,
|
||||
duration: this.timeout,
|
||||
message: 'Please wait...',
|
||||
message: 'Click the backdrop to dismiss early...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading',
|
||||
backdropDismiss: true
|
||||
})
|
||||
.then(l => {
|
||||
.then(loading=> {
|
||||
setTimeout(function() {
|
||||
l.dismiss()
|
||||
loading.dismiss()
|
||||
}, this.timeout)
|
||||
return l.present()
|
||||
return loading.present()
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -12,13 +12,12 @@ export class LoadingExample {
|
||||
|
||||
async presentLoading() {
|
||||
const loading = await this.loadingController.create({
|
||||
message: 'Hellooo',
|
||||
message: 'Please wait...',
|
||||
duration: 2000
|
||||
});
|
||||
await loading.present();
|
||||
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
|
||||
console.log('Loading dismissed!');
|
||||
}
|
||||
|
||||
@@ -26,11 +25,15 @@ export class LoadingExample {
|
||||
const loading = await this.loadingController.create({
|
||||
spinner: null,
|
||||
duration: 5000,
|
||||
message: 'Please wait...',
|
||||
message: 'Click the backdrop to dismiss early...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading'
|
||||
cssClass: 'custom-class custom-loading',
|
||||
backdropDismiss: true
|
||||
});
|
||||
return await loading.present();
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
console.log('Loading dismissed with role:', role);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loading = document.createElement('ion-loading');
|
||||
loading.message: 'Hellooo',
|
||||
loading.duration: 2000;
|
||||
loading.message = 'Please wait...';
|
||||
loading.duration = 2000;
|
||||
|
||||
document.body.appendChild(loading);
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
|
||||
console.log('Loading dismissed!');
|
||||
}
|
||||
|
||||
function presentLoadingWithOptions() {
|
||||
async function presentLoadingWithOptions() {
|
||||
const loading = document.createElement('ion-loading');
|
||||
|
||||
loading.spinner = null;
|
||||
loading.duration = 5000;
|
||||
loading.message = 'Please wait...';
|
||||
loading.message = 'Click the backdrop to dismiss early...';
|
||||
loading.translucent = true;
|
||||
loading.cssClass = 'custom-class custom-loading';
|
||||
loading.backdropDismiss = true;
|
||||
|
||||
document.body.appendChild(loading);
|
||||
return loading.present();
|
||||
await loading.present();
|
||||
|
||||
const { role, data } = await loading.onDidDismiss();
|
||||
console.log('Loading dismissed with role:', role);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -15,7 +15,7 @@ export const LoadingExample: React.FC = () => {
|
||||
<IonLoading
|
||||
isOpen={showLoading}
|
||||
onDidDismiss={() => setShowLoading(false)}
|
||||
message={'Loading...'}
|
||||
message={'Please wait...'}
|
||||
duration={5000}
|
||||
/>
|
||||
</IonContent>
|
||||
|
||||
@@ -16,14 +16,14 @@ export default {
|
||||
presentLoading() {
|
||||
return this.$ionic.loadingController
|
||||
.create({
|
||||
message: 'Loading',
|
||||
message: 'Please wait...',
|
||||
duration: this.timeout,
|
||||
})
|
||||
.then(l => {
|
||||
.then(loading => {
|
||||
setTimeout(function() {
|
||||
l.dismiss()
|
||||
loading.dismiss()
|
||||
}, this.timeout)
|
||||
return l.present()
|
||||
return loading.present()
|
||||
})
|
||||
},
|
||||
presentLoadingWithOptions() {
|
||||
@@ -31,15 +31,16 @@ export default {
|
||||
.create({
|
||||
spinner: null,
|
||||
duration: this.timeout,
|
||||
message: 'Please wait...',
|
||||
message: 'Click the backdrop to dismiss early...',
|
||||
translucent: true,
|
||||
cssClass: 'custom-class custom-loading',
|
||||
backdropDismiss: true
|
||||
})
|
||||
.then(l => {
|
||||
.then(loading=> {
|
||||
setTimeout(function() {
|
||||
l.dismiss()
|
||||
loading.dismiss()
|
||||
}, this.timeout)
|
||||
return l.present()
|
||||
return loading.present()
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user