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

47 lines
1.4 KiB
Vue

<template>
<DocPTViewer :docs="docs">
<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 {
docs: [
{
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>