2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2024-01-31 18:33:31 +00:00
|
|
|
<p>A message disappears after the number of milliseconds defined in the <i>life</i> option. Omit the <i>life</i> option to make the message sticky.</p>
|
2023-02-28 08:29:30 +00:00
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
2023-10-07 10:14:05 +00:00
|
|
|
<div class="flex flex-wrap gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showSticky" label="Sticky" />
|
|
|
|
<Button label="Clear" severity="secondary" @click="clear()" />
|
2023-10-07 10:14:05 +00:00
|
|
|
</div>
|
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 />
|
2023-10-07 10:14:05 +00:00
|
|
|
<Button @click="showSticky" label="Sticky" />
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button label="Clear" severity="secondary" @click="clear()" />
|
2023-10-15 09:38:39 +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 />
|
2023-10-07 10:14:05 +00:00
|
|
|
<div class="flex flex-wrap gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showSticky" label="Sticky" />
|
|
|
|
<Button label="Clear" severity="secondary" @click="clear()" />
|
2023-10-07 10:14:05 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2023-03-07 12:50:28 +00:00
|
|
|
methods: {
|
|
|
|
showSticky() {
|
|
|
|
this.$toast.add({ severity: 'info', summary: 'Sticky Message', detail: 'Message Content'});
|
2023-10-07 10:14:05 +00:00
|
|
|
},
|
|
|
|
clear() {
|
|
|
|
this.$toast.removeAllGroups();
|
2023-03-07 12:50:28 +00:00
|
|
|
}
|
|
|
|
}
|
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 />
|
2023-10-07 10:14:05 +00:00
|
|
|
<div class="flex flex-wrap gap-2">
|
2023-10-25 15:22:15 +00:00
|
|
|
<Button @click="showSticky" label="Sticky" />
|
|
|
|
<Button label="Clear" severity="secondary" @click="clear()" />
|
2023-10-07 10:14:05 +00:00
|
|
|
</div>
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { useToast } from "primevue/usetoast";
|
|
|
|
const toast = useToast();
|
|
|
|
|
|
|
|
const showSticky = () => {
|
2023-03-07 12:50:28 +00:00
|
|
|
toast.add({ severity: 'info', summary: 'Sticky Message', detail: 'Message Content'});
|
2023-10-07 10:14:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const clear = () => {
|
|
|
|
toast.removeAllGroups();
|
|
|
|
}
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
showSticky() {
|
2023-03-07 12:50:28 +00:00
|
|
|
this.$toast.add({ severity: 'info', summary: 'Sticky Message', detail: 'Message Content' });
|
2023-10-07 10:14:05 +00:00
|
|
|
},
|
|
|
|
clear() {
|
|
|
|
this.$toast.removeAllGroups();
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|