primevue-mirror/doc/dynamicdialog/CloseDialogDoc.vue

43 lines
937 B
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>The <i>close</i> function of the <i>dialogRef</i> is used to hide a Dialog. The <i>dialogRef</i> is injected to the component that is loaded by the dialog.</p>
</DocSectionText>
<DocSectionCode :code="code" import hideCodeSandbox hideStackBlitz />
</template>
<script>
export default {
data() {
return {
code: {
basic: `
export default {
inject: ['dialogRef'],
methods:{
closeDialog() {
this.dialogRef.close();
}
}
}`,
options: `
export default {
inject: ['dialogRef'],
methods:{
closeDialog() {
this.dialogRef.close();
}
}
}`,
composition: `
import { inject } from "vue";
const dialogRef = inject('dialogRef');
const closeDialog = () => {
dialogRef.value.close();
}`
}
};
}
};
</script>