primevue-mirror/doc/toast/MultipleDoc.vue

74 lines
2.5 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Multiple messages are displayed by passing an array to the <i>show</i> method.</p>
</DocSectionText>
<div class="card flex justify-content-center">
2024-04-16 07:35:56 +00:00
<Button label="Multiple" severity="warn" @click="showMultiple()" />
2023-02-28 08:29:30 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Toast />
2024-04-16 07:35:56 +00:00
<Button label="Multiple" severity="warn" @click="showMultiple()" />
2023-10-07 10:14:05 +00:00
`,
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 />
2024-04-16 07:35:56 +00:00
<Button label="Multiple" severity="warn" @click="showMultiple()" />
2023-02-28 08:29:30 +00:00
</div>
</template>
<script>
export default {
methods: {
showMultiple() {
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Message Content', life: 3000 });
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3050 });
2024-05-08 11:35:11 +00:00
this.$toast.add({ severity: 'warn', summary: 'Warn', detail: 'Message Content', life: 3100 });
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'error', summary: 'Error', detail: 'Message Content', life: 3150 });
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 />
2024-04-16 07:35:56 +00:00
<Button label="Multiple" severity="warn" @click="showMultiple()" />
2023-02-28 08:29:30 +00:00
</div>
</template>
<script setup>
import { useToast } from "primevue/usetoast";
const toast = useToast();
const showMultiple = () => {
2023-03-07 12:50:28 +00:00
toast.add({ severity: 'success', summary: 'Success', detail: 'Message Content', life: 3000 });
toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3050 });
2024-05-08 11:35:11 +00:00
toast.add({ severity: 'warn', summary: 'Warn', detail: 'Message Content', life: 3100 });
2023-03-07 12:50:28 +00:00
toast.add({ severity: 'error', summary: 'Error', detail: 'Message Content', life: 3150 });
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: {
showMultiple() {
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'Message Content', life: 3000 });
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', life: 3050 });
2024-05-08 11:35:11 +00:00
this.$toast.add({ severity: 'warn', summary: 'Warn', detail: 'Message Content', life: 3100 });
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'error', summary: 'Error', detail: 'Message Content', life: 3150 });
2023-02-28 08:29:30 +00:00
}
}
};
</script>