Fixed confirm popup docs
parent
10bbf2c681
commit
0d03efef10
|
@ -31,20 +31,22 @@ import ConfirmPopup from 'primevue/confirmpopup';
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h5>Getting Started</h5>
|
<h5>Getting Started</h5>
|
||||||
<p>ConfirmPopup is displayed by calling the <i>require</i> method of the <i>$confirm</i> instance by passing the options to customize the Popup.</p>
|
<p>ConfirmPopup is displayed by calling the <i>require</i> method of the <i>$confirm</i> instance by passing the options to customize the Popup.
|
||||||
|
<i>target</i> attribute is mandatory to align the popup to its caller.</p>
|
||||||
<pre v-code>
|
<pre v-code>
|
||||||
<code>
|
<code>
|
||||||
<ConfirmPopup></ConfirmPopup>
|
<ConfirmPopup></ConfirmPopup>
|
||||||
|
|
||||||
<Button @click="delete()" icon="pi pi-check" label="Confirm"></Button>
|
<Button @click="delete($event)" icon="pi pi-check" label="Confirm"></Button>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<pre v-code.script>
|
<pre v-code.script>
|
||||||
<code>
|
<code>
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
delete() {
|
delete(event) {
|
||||||
this.$confirm.require({
|
this.$confirm.require({
|
||||||
|
target: event.currentTarget,
|
||||||
message: 'Are you sure you want to proceed?',
|
message: 'Are you sure you want to proceed?',
|
||||||
icon: 'pi pi-exclamation-triangle',
|
icon: 'pi pi-exclamation-triangle',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
|
@ -70,16 +72,21 @@ import { useConfirm } from "primevue/useconfirm";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
confirm.require({
|
|
||||||
message: 'Are you sure you want to proceed?',
|
function delete(event) {
|
||||||
icon: 'pi pi-exclamation-triangle',
|
confirm.require({
|
||||||
accept: () => {
|
message: 'Are you sure you want to proceed?',
|
||||||
//callback to execute when user confirms the action
|
icon: 'pi pi-exclamation-triangle',
|
||||||
},
|
accept: () => {
|
||||||
reject: () => {
|
//callback to execute when user confirms the action
|
||||||
//callback to execute when user rejects the action
|
},
|
||||||
}
|
reject: () => {
|
||||||
});
|
//callback to execute when user rejects the action
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {delete};
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -112,6 +119,12 @@ export default {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>target</td>
|
||||||
|
<td>DomElement</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Element to align the overlay.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>message</td>
|
<td>message</td>
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
|
@ -263,8 +276,9 @@ export default {
|
||||||
<code>
|
<code>
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
confirm1() {
|
confirm1(event) {
|
||||||
this.$confirm.require({
|
this.$confirm.require({
|
||||||
|
target: event.currentTarget,
|
||||||
message: 'Are you sure you want to proceed?',
|
message: 'Are you sure you want to proceed?',
|
||||||
icon: 'pi pi-exclamation-triangle',
|
icon: 'pi pi-exclamation-triangle',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
|
@ -275,8 +289,9 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
confirm2() {
|
confirm2(event) {
|
||||||
this.$confirm.require({
|
this.$confirm.require({
|
||||||
|
target: event.currentTarget,
|
||||||
message: 'Do you want to delete this record?',
|
message: 'Do you want to delete this record?',
|
||||||
icon: 'pi pi-info-circle',
|
icon: 'pi pi-info-circle',
|
||||||
acceptClass: 'p-button-danger',
|
acceptClass: 'p-button-danger',
|
||||||
|
|
Loading…
Reference in New Issue