primevue-mirror/doc/dynamicdialog/CloseDialogDoc.vue

46 lines
944 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>
2023-03-13 13:31:27 +00:00
<DocSectionCode :code="code" importCode hideCodeSandbox 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: `
export default {
2023-02-28 08:29:30 +00:00
inject: ['dialogRef'],
methods:{
closeDialog() {
this.dialogRef.close();
}
}
2023-09-26 12:14:16 +00:00
}
2023-10-15 09:38:39 +00:00
2023-09-26 12:14:16 +00:00
`,
2023-02-28 08:29:30 +00:00
options: `
export default {
inject: ['dialogRef'],
methods:{
closeDialog() {
this.dialogRef.close();
}
}
2023-10-15 09:38:39 +00:00
}
`,
2023-02-28 08:29:30 +00:00
composition: `
import { inject } from "vue";
const dialogRef = inject('dialogRef');
const closeDialog = () => {
dialogRef.value.close();
}`
}
};
}
};
</script>