primevue-mirror/apps/showcase/doc/dynamicdialog/CloseDialogDoc.vue

27 lines
574 B
Vue
Raw Permalink Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-11-02 06:28:24 +00:00
<p>The <i>close</i> function is available through a <i>dialogRef</i> that is injected to the component loaded by the dialog.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2024-01-30 08:16:35 +00:00
<DocSectionCode :code="code" importCode hideToggleCode hideStackBlitz />
2023-02-28 08:29:30 +00:00
</template>
<script>
export default {
data() {
return {
code: {
2023-09-26 12:14:16 +00:00
basic: `
2023-02-28 08:29:30 +00:00
import { inject } from "vue";
const dialogRef = inject('dialogRef');
2023-11-02 06:28:24 +00:00
2023-02-28 08:29:30 +00:00
const closeDialog = () => {
dialogRef.value.close();
2023-11-02 06:28:24 +00:00
}
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>