primevue-mirror/doc/dynamicdialog/DialogServiceDoc.vue

41 lines
1.2 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-03-08 08:35:24 +00:00
<p>Dynamic dialogs are controlled via the <i>DialogService</i> that needs to be installed as an application plugin.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2023-03-08 08:35:24 +00:00
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
<div class="doc-section-description">
<p><i>$dialog</i> is available as a property in the application instance for Options API. The service can be injected with the <i>useDialog</i> function for Composition API.</p>
</div>
2023-03-13 12:36:33 +00:00
<DocSectionCode :code="code2" importCode hideCodeSandbox hideStackBlitz />
2023-02-28 08:29:30 +00:00
</template>
<script>
export default {
data() {
return {
2023-03-08 08:35:24 +00:00
code1: {
2023-09-22 12:54:14 +00:00
basic: `
import {createApp} from 'vue';
2023-02-28 08:29:30 +00:00
import DialogService from 'primevue/dialogservice';
const app = createApp(App);
2023-09-26 12:14:16 +00:00
app.use(DialogService);
`
2023-03-08 08:35:24 +00:00
},
code2: {
2023-09-22 12:54:14 +00:00
basic: `
import { useDialog } from 'primevue/usedialog';
2023-03-08 08:35:24 +00:00
2023-09-26 12:14:16 +00:00
const dialog = useDialog();
`,
2023-03-08 08:35:24 +00:00
options: `const dialogRef = this.$dialog;`,
composition: `
import { useDialog } from 'primevue/usedialog';
const dialog = useDialog();`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>