primevue-mirror/apps/showcase/doc/speeddial/QuarterCircleDoc.vue

188 lines
6.9 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Setting <i>type</i> as <i>quarter-circle</i> displays the items at one of four corners of a button based on the <i>direction</i>.</p>
</DocSectionText>
<div class="card">
2024-05-29 23:36:11 +00:00
<div style="position: relative; height: 500px">
2024-03-18 10:29:19 +00:00
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-left" :style="{ position: 'absolute', right: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-right" :style="{ position: 'absolute', left: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-left" :style="{ position: 'absolute', right: 0, top: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-right" :style="{ position: 'absolute', left: 0, top: 0 }" />
2023-02-28 08:29:30 +00:00
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Add',
icon: 'pi pi-pencil',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'info', summary: 'Add', detail: 'Data Added', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Update',
icon: 'pi pi-refresh',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'success', summary: 'Update', detail: 'Data Updated', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Delete',
icon: 'pi pi-trash',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'error', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
this.$router.push('/fileupload');
}
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/';
}
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-03-18 10:29:19 +00:00
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-left" :style="{ position: 'absolute', right: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-right" :style="{ position: 'absolute', left: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-left" :style="{ position: 'absolute', right: 0, top: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-right" :style="{ position: 'absolute', left: 0, top: 0 }" />
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2024-05-29 23:36:11 +00:00
<div style="position: relative; height: 500px">
2024-03-18 10:29:19 +00:00
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-left" :style="{ position: 'absolute', right: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-right" :style="{ position: 'absolute', left: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-left" :style="{ position: 'absolute', right: 0, top: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-right" :style="{ position: 'absolute', left: 0, top: 0 }" />
2023-08-07 12:40:22 +00:00
<Toast />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Add',
icon: 'pi pi-pencil',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'info', summary: 'Add', detail: 'Data Added', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Update',
icon: 'pi pi-refresh',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'success', summary: 'Update', detail: 'Data Updated', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Delete',
icon: 'pi pi-trash',
command: () => {
2024-05-29 23:28:03 +00:00
this.$toast.add({ severity: 'error', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
this.$router.push('/fileupload');
}
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/';
}
}
]
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2024-05-29 23:36:11 +00:00
<div style="position: relative; height: 500px">
2024-03-18 10:29:19 +00:00
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-left" :style="{ position: 'absolute', right: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="up-right" :style="{ position: 'absolute', left: 0, bottom: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-left" :style="{ position: 'absolute', right: 0, top: 0 }" />
<SpeedDial :model="items" :radius="120" type="quarter-circle" direction="down-right" :style="{ position: 'absolute', left: 0, top: 0 }" />
2023-08-07 12:40:22 +00:00
<Toast />
2023-02-28 08:29:30 +00:00
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { useToast } from 'primevue/usetoast';
import { useRouter } from 'vue-router';
const toast = useToast();
const router = useRouter();
const items = ref([
{
label: 'Add',
icon: 'pi pi-pencil',
command: () => {
2024-05-29 23:28:03 +00:00
toast.add({ severity: 'info', summary: 'Add', detail: 'Data Added', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Update',
icon: 'pi pi-refresh',
command: () => {
2024-05-29 23:28:03 +00:00
toast.add({ severity: 'success', summary: 'Update', detail: 'Data Updated', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Delete',
icon: 'pi pi-trash',
command: () => {
2024-05-29 23:28:03 +00:00
toast.add({ severity: 'error', summary: 'Delete', detail: 'Data Deleted', life: 3000 });
2023-02-28 08:29:30 +00:00
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
router.push('/fileupload');
}
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/'
}
}
])
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>