add toast-notification

This commit is contained in:
jxxghp
2023-07-03 17:00:38 +08:00
parent 569f88617a
commit 3240e259ed
4 changed files with 14 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
import api from "@/api";
import { doneNProgress, startNProgress } from "@/api/nprogress";
import { MediaInfo, Subscribe } from "@/api/types";
import { useToast } from "vue-toast-notification";
// 输入参数
const props = defineProps({
@@ -10,6 +11,9 @@ const props = defineProps({
height: String,
});
// 提示框
const $toast = useToast();
// 图片加载状态
const isImageLoaded = ref(false);
@@ -44,7 +48,7 @@ const addSubscribe = async () => {
// 订阅成功
isSubscribed.value = true;
} else {
// TODO 弹出错误提示
$toast.error(`${props.media?.title} 添加订阅失败:${result.message}`);
}
} catch (error) {
console.error(error);

View File

@@ -10,6 +10,8 @@ import '@core/scss/template/index.scss'
import '@layouts/styles/index.scss'
import '@styles/styles.scss'
import { createApp } from 'vue'
import ToastPlugin from 'vue-toast-notification'
import 'vue-toast-notification/dist/theme-default.css'
loadFonts()
// Nprogress
@@ -23,6 +25,7 @@ app
.use(vuetify)
.use(router)
.use(store)
.use(ToastPlugin)
.mount('#app')