primevue-mirror/doc/toast/StickyDoc.vue

59 lines
1.5 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>A message disappears after 3000ms defined the <i>life</i> option, set <i>sticky</i> option to display messages that do not hide automatically.</p>
</DocSectionText>
<div class="card flex justify-content-center">
<Button @click="showSticky" label="Sticky" />
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
2023-08-16 13:58:31 +00:00
basic: `<Toast />
2023-02-28 08:29:30 +00:00
<Button @click="showSticky" label="Sticky" />`,
2023-08-16 13:58:31 +00:00
options: `<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Toast />
<Button @click="showSticky" label="Sticky" />
</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-02-28 08:29:30 +00:00
};
<\/script>`,
2023-08-16 13:58:31 +00:00
composition: `<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Toast />
<Button @click="showSticky" label="Sticky" />
</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-02-28 08:29:30 +00:00
};
<\/script>`
}
};
},
methods: {
showSticky() {
2023-03-07 12:50:28 +00:00
this.$toast.add({ severity: 'info', summary: 'Sticky Message', detail: 'Message Content' });
2023-02-28 08:29:30 +00:00
}
}
};
</script>