Estou tentando utilizar esta biblioteca
no main.ts
Inclui
import { createApp } from "vue";
import App from "./App.vue";
const app = createApp(App);
app.use(PrimeVue, { ripple: true });
app.use(ToastService);
app.component("Toast", Toast);
TemaCadastrar.vue
<script setup lang="ts">
import { ref } from "vue";
import BaseBreadcrumb from "@/components/shared/BaseBreadcrumb.vue";
import UiParentCard from "@/components/shared/UiParentCard.vue";
import { router } from "@/router";
import { useTemaStore } from "@/stores/apps/tema";
import { useToast } from "primevue/usetoast";
const toast = useToast();
const page = ref({ title: "Temas de Estudo" });
const breadcrumbs = ref([
{
disabled: true,
href: "#",
},
]);
const store = useTemaStore();
const valid = ref(true);
const editedIndex = ref(-1);
let editedItem = ref({
nome: "",
indAtivo: false,
});
const desserts = ref({});
const limpar = () => {
editedItem.value = {
nome: "",
indAtivo: false,
};
};
const save = async () => {
if (editedIndex.value > -1) {
Object.assign(editedIndex.value, editedItem.value);
} else {
desserts.value = editedItem.value;
}
await store
.salvar({
nome: editedItem.value.nome,
})
.then(() => {
toast.add({
severity: "success",
summary: "OK",
detail: "Tema cadastrado com sucesso !",
life: 30000,
});
router.push("/tema");
});
};
</script>
<template>
<v-row>
<v-col cols="1" md="1">
<v-btn icon variant="text" @click="router.back">
<v-tooltip activator="parent"> Voltar </v-tooltip>
<ArrowBackUpIcon size="18" />
</v-btn>
</v-col>
<v-col cols="11" md="11">
<BaseBreadcrumb
:title="page.title"
:breadcrumbs="breadcrumbs"
></BaseBreadcrumb>
</v-col>
</v-row>
<v-row>
<v-col cols="12" md="12">
<UiParentCard title="Cadastrar tema de estudo">
<v-card-text>
<v-form ref="form" v-model="valid" lazy-validation>
<v-col cols="12" sm="12">
<v-text-field
variant="outlined"
hide-details
v-model="editedItem.nome"
label="Nome"
></v-text-field>
</v-col>
</v-form>
</v-card-text>
<v-card-actions class="pa-4">
<v-spacer></v-spacer>
<v-btn color="error" @click="limpar" variant="flat">
<v-icon>mdi-drag</v-icon>
<v-tooltip activator="parent"> Limpar </v-tooltip>
</v-btn>
<v-btn
color="primary"
variant="flat"
@click="save"
:disabled="editedItem.nome === ''"
>
<v-tooltip activator="parent"> Salvar </v-tooltip>
<v-icon>mdi-content-save</v-icon>
</v-btn>
</v-card-actions>
</UiParentCard>
</v-col>
</v-row>
</template>
Não dá erro mas quando clico em salvar, ele não mostra a mensagem em toast
O que falta ?