2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2023-03-08 08:35:24 +00:00
|
|
|
<p>Toast component is controlled via the <i>ToastService</i> that needs to be installed as an application plugin.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
2023-03-28 06:38:25 +00:00
|
|
|
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
|
|
|
|
<div class="doc-section-description">
|
|
|
|
<p><i>$toast</i> is available as a property in the application instance for Options API. The service can be injected with the <i>useToast</i> function for Composition API.</p>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code2" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
|
2023-02-28 08:29:30 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2023-03-28 06:38:25 +00:00
|
|
|
code1: {
|
2023-08-16 13:58:31 +00:00
|
|
|
basic: `import {createApp} from 'vue';
|
2023-02-28 08:29:30 +00:00
|
|
|
import ToastService from 'primevue/toastservice';
|
|
|
|
|
|
|
|
const app = createApp(App);
|
|
|
|
app.use(ToastService);`
|
2023-03-28 06:38:25 +00:00
|
|
|
},
|
|
|
|
code2: {
|
2023-08-16 13:58:31 +00:00
|
|
|
basic: `import { useToast } from 'primevue/usetoast';
|
2023-03-28 06:38:25 +00:00
|
|
|
|
|
|
|
const toast = useToast();`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|