mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
docs(vue): add loading usage vue docs (#17661)
This commit is contained in:
committed by
Josh Thomas
parent
f205b1023b
commit
928b2f7843
48
core/src/components/loading/usage/vue.md
Normal file
48
core/src/components/loading/usage/vue.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<IonVuePage :title="'Loading'">
|
||||||
|
<ion-button @click="presentLoading">Show Loading</ion-button>
|
||||||
|
<br />
|
||||||
|
<ion-button @click="presentLoadingWithOptions">Show Loading</ion-button>
|
||||||
|
</IonVuePage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
timeout: { type: Number, default: 1000 },
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
presentLoading() {
|
||||||
|
return this.$ionic.loadingController
|
||||||
|
.create({
|
||||||
|
message: 'Loading',
|
||||||
|
duration: this.timeout,
|
||||||
|
})
|
||||||
|
.then(l => {
|
||||||
|
setTimeout(function() {
|
||||||
|
l.dismiss()
|
||||||
|
}, this.timeout)
|
||||||
|
return l.present()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
presentLoadingWithOptions() {
|
||||||
|
return this.$ionic.loadingController
|
||||||
|
.create({
|
||||||
|
spinner: null,
|
||||||
|
duration: this.timeout,
|
||||||
|
message: 'Please wait...',
|
||||||
|
translucent: true,
|
||||||
|
cssClass: 'custom-class custom-loading',
|
||||||
|
})
|
||||||
|
.then(l => {
|
||||||
|
setTimeout(function() {
|
||||||
|
l.dismiss()
|
||||||
|
}, this.timeout)
|
||||||
|
return l.present()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user