安装
npm install --save vue-toastification@next
main.js
import Toast from "vue-toastification";
import "vue-toastification/dist/index.css";
const options = {
position: "top-center",
timeout: 3000,
hideProgressBar: true,
}
const app = createApp(App);
app.use(Toast, options);
模板
<script setup>
import { useToast } from "vue-toastification";
const toast = useToast();
// 可用类型
toast.info('提示信息');
toast.success('提示信息');
toast.warning('提示信息');
toast.error('提示信息');