fix(utils): 修复新增公告,SSE消息字典未解析问题
This commit is contained in:
+6
-5
@@ -37,16 +37,17 @@ export const initSSE = (url: string) => {
|
|||||||
|
|
||||||
watch(data, () => {
|
watch(data, () => {
|
||||||
if (!data.value) return;
|
if (!data.value) return;
|
||||||
useNoticeStore().addNotice({
|
|
||||||
message: data.value,
|
|
||||||
read: false,
|
|
||||||
time: new Date().toLocaleString()
|
|
||||||
});
|
|
||||||
let content = data.value;
|
let content = data.value;
|
||||||
const noticeType = content.match(/\[dict\.(.*?)\]/)?.[1];
|
const noticeType = content.match(/\[dict\.(.*?)\]/)?.[1];
|
||||||
if (noticeType) {
|
if (noticeType) {
|
||||||
content = content.replace(`dict.${noticeType}`, $t(`dict.${noticeType}` as App.I18n.I18nKey));
|
content = content.replace(`dict.${noticeType}`, $t(`dict.${noticeType}` as App.I18n.I18nKey));
|
||||||
}
|
}
|
||||||
|
useNoticeStore().addNotice({
|
||||||
|
message: content,
|
||||||
|
read: false,
|
||||||
|
time: new Date().toLocaleString()
|
||||||
|
});
|
||||||
window.$notification?.create({
|
window.$notification?.create({
|
||||||
title: '消息',
|
title: '消息',
|
||||||
content,
|
content,
|
||||||
|
|||||||
Reference in New Issue
Block a user