feat: 重构signalr,在线人数允许不用登录
This commit is contained in:
28
Yi.Bbs.Vue3/src/hubs/noticeHub.js
Normal file
28
Yi.Bbs.Vue3/src/hubs/noticeHub.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import signalR from "@/utils/signalR";
|
||||
const receiveMsg=(connection)=> {
|
||||
connection.on("receiveNotice", (type, title, content) => {
|
||||
switch (type) {
|
||||
case "MerryGoRound":
|
||||
ElNotification({
|
||||
title: title,
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: content,
|
||||
})
|
||||
break;
|
||||
case "Popup":
|
||||
ElNotification({
|
||||
title: title,
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: content,
|
||||
})
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
export default ()=>{
|
||||
signalR.start(`notice`,receiveMsg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user