primevue-mirror/doc/toast/pt/PTDoc.vue

84 lines
1.8 KiB
Vue
Raw Normal View History

2023-04-28 13:41:43 +00:00
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card flex justify-content-center">
<Toast
group="pt"
:pt="{
container: { class: 'bg-yellow-100' }
}"
/>
<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-04-28 13:41:43 +00:00
group="pt"
:pt="{
container: { class: 'bg-yellow-100' }
}"
/>
2023-10-15 09:38:39 +00:00
<Button label="Show" @click="show()" />
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-04-28 13:41:43 +00:00
<div class="card flex justify-content-center">
<Toast
group="pt"
:pt="{
container: { class: 'bg-yellow-100' }
}"
/>
<Button label="Show" @click="show()" />
</div>
</template>
<script>
export default {
methods: {
show() {
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', group: 'pt', life: 3000 });
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-04-28 13:41:43 +00:00
<div class="card flex justify-content-center">
<Toast
group="pt"
:pt="{
container: { class: 'bg-yellow-100' }
}"
/>
<Button label="Show" @click="show()" />
</div>
</template>
<script setup>
import { useToast } from "primevue/usetoast";
const toast = useToast();
const show = () => {
toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', group: 'pt', life: 3000 });
};
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-04-28 13:41:43 +00:00
}
};
},
methods: {
show() {
this.$toast.add({ severity: 'info', summary: 'Info', detail: 'Message Content', group: 'pt', life: 3000 });
}
}
};
</script>