primevue-mirror/apps/volt/doc/button/LoadingDoc.vue

46 lines
1022 B
Vue
Raw Permalink Normal View History

2025-03-04 10:12:57 +00:00
<template>
<DocSectionText v-bind="$attrs">
2025-03-04 11:17:02 +00:00
<p>Busy state is controlled with the <i>loading</i> property.</p>
2025-03-04 10:12:57 +00:00
</DocSectionText>
<div class="card flex justify-center">
2025-03-04 11:17:02 +00:00
<Button type="button" label="Search" icon="pi pi-check" :loading="loading" @click="load" />
2025-03-04 10:12:57 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script setup>
import Button from '@/volt/button';
import { ref } from 'vue';
2025-03-04 11:17:02 +00:00
const loading = ref(false);
const load = () => {
loading.value = true;
setTimeout(() => {
loading.value = false;
}, 2000);
};
2025-03-04 10:12:57 +00:00
const code = ref(`
<template>
<div class="card flex justify-center">
2025-03-04 11:17:02 +00:00
<Button type="button" label="Search" icon="pi pi-check" :loading="loading" @click="load" />
2025-03-04 10:12:57 +00:00
</div>
</template>
<script setup>
import Button from '@/volt/button';
2025-03-04 11:17:02 +00:00
import { ref } from 'vue';
const loading = ref(false);
const load = () => {
loading.value = true;
setTimeout(() => {
loading.value = false;
}, 2000);
};
2025-03-04 10:12:57 +00:00
<\/script>
`);
</script>