feat:新增网站通知,右上角显示,只显示一次同一个内容
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from "vue";
|
||||
import { request } from "@/utils/request";
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { useConfigStore } from "@/stores/config";
|
||||
|
||||
const { config } = useConfigStore();
|
||||
onMounted(() => {
|
||||
request({
|
||||
url:'/',
|
||||
@@ -9,9 +12,19 @@ onMounted(() => {
|
||||
}).then((res:any)=>{
|
||||
if (res.code === 200) {
|
||||
localStorage.setItem('config', JSON.stringify(res.detail));
|
||||
if (config.notify_title && config.notify_content && localStorage.getItem('notify') !== config.notify_title + config.notify_content) {
|
||||
localStorage.setItem('notify', config.notify_title + config.notify_content);
|
||||
ElNotification({
|
||||
title: config.notify_title,
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: config.notify_content,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user