112 lines
3.8 KiB
Vue
112 lines
3.8 KiB
Vue
|
<template>
|
||
|
<DocSectionText v-bind="$attrs">
|
||
|
<p>The <i>severity</i> option specifies the type of the message.</p>
|
||
|
</DocSectionText>
|
||
|
<div class="card flex justify-content-center">
|
||
|
<div class="flex flex-wrap gap-2">
|
||
|
<Button label="Success" class="p-button-success" @click="showSuccess" />
|
||
|
<Button label="Info" class="p-button-info" @click="showInfo" />
|
||
|
<Button label="Warn" class="p-button-warning" @click="showWarn" />
|
||
|
<Button label="Error" class="p-button-danger" @click="showError" />
|
||
|
</div>
|
||
|
</div>
|
||
|
<DocSectionCode :code="code" />
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
code: {
|
||
|
basic: `
|
||
|
<Toast />
|
||
|
<div class="flex flex-wrap gap-2">
|
||
|
<Button label="Success" class="p-button-success" @click="showSuccess" />
|
||
|
<Button label="Info" class="p-button-info" @click="showInfo" />
|
||
|
<Button label="Warn" class="p-button-warning" @click="showWarn" />
|
||
|
<Button label="Error" class="p-button-danger" @click="showError" />
|
||
|
</div>`,
|
||
|
options: `
|
||
|
<template>
|
||
|
<div class="card flex justify-content-center">
|
||
|
<Toast />
|
||
|
<div class="flex flex-wrap gap-2">
|
||
|
<Button label="Success" class="p-button-success" @click="showSuccess" />
|
||
|
<Button label="Info" class="p-button-info" @click="showInfo" />
|
||
|
<Button label="Warn" class="p-button-warning" @click="showWarn" />
|
||
|
<Button label="Error" class="p-button-danger" @click="showError" />
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
methods: {
|
||
|
showSuccess() {
|
||
|
this.$toast.add({ severity: 'success', summary: 'Success Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showInfo() {
|
||
|
this.$toast.add({ severity: 'info', summary: 'Info Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showWarn() {
|
||
|
this.$toast.add({ severity: 'warn', summary: 'Warn Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showError() {
|
||
|
this.$toast.add({ severity: 'error', summary: 'Error Message', detail: 'Message Content' });
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
<\/script>`,
|
||
|
composition: `
|
||
|
<template>
|
||
|
<div class="card flex justify-content-center">
|
||
|
<Toast />
|
||
|
<div class="flex flex-wrap gap-2">
|
||
|
<Button label="Success" class="p-button-success" @click="showSuccess" />
|
||
|
<Button label="Info" class="p-button-info" @click="showInfo" />
|
||
|
<Button label="Warn" class="p-button-warning" @click="showWarn" />
|
||
|
<Button label="Error" class="p-button-danger" @click="showError" />
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script setup>
|
||
|
import { useToast } from "primevue/usetoast";
|
||
|
const toast = useToast();
|
||
|
|
||
|
const showSuccess = () => {
|
||
|
toast.add({ severity: 'success', summary: 'Success Message', detail: 'Message Content' });
|
||
|
};
|
||
|
|
||
|
const showInfo = () => {
|
||
|
toast.add({ severity: 'info', summary: 'Info Message', detail: 'Message Content' });
|
||
|
};
|
||
|
|
||
|
const showWarn = () => {
|
||
|
toast.add({ severity: 'warn', summary: 'Warn Message', detail: 'Message Content' });
|
||
|
};
|
||
|
|
||
|
const showError = () => {
|
||
|
toast.add({ severity: 'error', summary: 'Error Message', detail: 'Message Content' });
|
||
|
};
|
||
|
<\/script>`
|
||
|
}
|
||
|
};
|
||
|
},
|
||
|
methods: {
|
||
|
showSuccess() {
|
||
|
this.$toast.add({ severity: 'success', summary: 'Success Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showInfo() {
|
||
|
this.$toast.add({ severity: 'info', summary: 'Info Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showWarn() {
|
||
|
this.$toast.add({ severity: 'warn', summary: 'Warn Message', detail: 'Message Content' });
|
||
|
},
|
||
|
showError() {
|
||
|
this.$toast.add({ severity: 'error', summary: 'Error Message', detail: 'Message Content' });
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|