primevue-mirror/doc/toast/BasicDoc.vue

68 lines
1.6 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>
2023-10-25 15:22:15 +00:00
Ideal location of a Toast is the main application template so that it can be used by any component within the application. A single message is represented by the Message interface that defines properties such as severity, summary and
detail.
2023-02-28 08:29:30 +00:00
</p>
</DocSectionText>
<div class="card flex justify-content-center">
<Button label="Show" @click="show()" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Toast />
2023-10-15 09:38:39 +00:00
<Button label="Show" @click="show()" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Toast />
<Button label="Show" @click="show()" />
</div>
</template>
<script>
export default {
methods: {
show() {
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3000 });
2023-02-28 08:29:30 +00:00
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Toast />
<Button label="Show" @click="show()" />
</div>
</template>
<script setup>
import { useToast } from "primevue/usetoast";
const toast = useToast();
const show = () => {
2023-03-07 12:50:28 +00:00
toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3000 });
2023-02-28 08:29:30 +00:00
};
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
methods: {
show() {
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3000 });
2023-02-28 08:29:30 +00:00
}
}
};
</script>