primevue-mirror/apps/showcase/doc/confirmpopup/pt/PTViewer.vue

47 lines
1.4 KiB
Vue
Raw Normal View History

2024-09-16 10:23:30 +00:00
<template>
2024-09-20 12:22:44 +00:00
<DocPTViewer :docs="docs">
2024-09-16 10:23:30 +00:00
<ConfirmPopup group="ptviewer"></ConfirmPopup>
<Button ref="btn" @click="confirm1($event)" label="Open Popup" outlined></Button>
</DocPTViewer>
</template>
<script>
import { getPTOptions } from '@/components/doc/helpers';
export default {
data() {
return {
2024-09-20 12:22:44 +00:00
docs: [
2024-09-16 10:23:30 +00:00
{
data: getPTOptions('ConfirmPopup'),
key: 'ConfirmPopup'
}
]
};
},
methods: {
confirm1(event) {
this.$confirm.require({
target: event.currentTarget,
message: 'Are you sure you want to proceed?',
icon: 'pi pi-exclamation-triangle',
rejectProps: {
label: 'Cancel',
severity: 'secondary',
outlined: true
},
acceptProps: {
label: 'Save'
},
accept: () => {
this.$toast.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted', life: 3000 });
},
reject: () => {
this.$toast.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 });
}
});
}
}
};
</script>