-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!141 发布 vue 版本 5.2.2 与 cloud 版本 2.2.1
Merge pull request !141 from 疯狂的狮子Li/dev
- Loading branch information
Showing
22 changed files
with
132 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { getToken } from '@/utils/auth'; | ||
import { ElNotification } from 'element-plus'; | ||
import useNoticeStore from '@/store/modules/notice'; | ||
|
||
let message = ''; | ||
|
||
// 初始化 | ||
export const initSSE = (url: any) => { | ||
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID | ||
const { | ||
data, | ||
error | ||
} = useEventSource(url, [], { | ||
autoReconnect: { | ||
retries: 10, | ||
delay: 3000, | ||
onFailed() { | ||
console.log('Failed to connect after 10 retries') | ||
}, | ||
} | ||
}); | ||
|
||
watch(error, () => { | ||
console.log('SSE connection error:', error.value) | ||
error.value = null; | ||
}); | ||
|
||
watch(data, () => { | ||
if (!data.value) return; | ||
useNoticeStore().addNotice({ | ||
message: data.value, | ||
read: false, | ||
time: new Date().toLocaleString() | ||
}); | ||
ElNotification({ | ||
title: '消息', | ||
message: data.value, | ||
type: 'success', | ||
duration: 3000 | ||
}); | ||
data.value = null; | ||
}); | ||
}; | ||
|
||
|
Oops, something went wrong.