优化
This commit is contained in:
@ -25,15 +25,31 @@ export const initSSE = (url: any) => {
|
||||
});
|
||||
|
||||
watch(data, () => {
|
||||
if (!data.value) return;
|
||||
console.log(data.value);
|
||||
let label = '';
|
||||
let route1 = '';
|
||||
try {
|
||||
if (JSON.parse(data.value)) {
|
||||
const obj = JSON.parse(data.value);
|
||||
route1 = obj.route;
|
||||
label = obj.message;
|
||||
data.value = null;
|
||||
}
|
||||
} catch (error) {
|
||||
label = data.value;
|
||||
}
|
||||
console.log(route1);
|
||||
console.log(label);
|
||||
// if (!data.value) return;
|
||||
useNoticeStore().addNotice({
|
||||
message: data.value,
|
||||
message: label,
|
||||
read: false,
|
||||
time: new Date().toLocaleString()
|
||||
time: new Date().toLocaleString(),
|
||||
route: route1
|
||||
});
|
||||
ElNotification({
|
||||
title: '消息',
|
||||
message: data.value,
|
||||
message: label,
|
||||
type: 'success',
|
||||
duration: 3000
|
||||
});
|
||||
|
Reference in New Issue
Block a user