<template>
<ion-content>
<ion-button @click="setOpen(true)">Show Loading</ion-button>
<ion-loading
:is-open="isOpenRef"
cssClass="my-custom-class"
message="Please wait..."
:duration="timeout"
@didDismiss="setOpen(false)"
>
</ion-loading>
</ion-content>
</template>
<script lang="ts">
import { IonButton, IonContent, IonLoading } from '@ionic/vue';
import { defineComponent, ref } from 'vue';
export default defineComponent({
props: {
timeout: { type: Number, default: 1000 },
},
components: { IonButton, IonContent, IonLoading },
setup() {
const isOpenRef = ref(false);
const setOpen = (state: boolean) => (isOpenRef.value = state);
return { isOpenRef, setOpen };
},
});
</script>