Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Y
yishuju-ui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何远江
yishuju-ui
Commits
f859370e
Commit
f859370e
authored
Apr 10, 2025
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
websocket修改
parent
cd5986e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
websocket.js
src/stores/modules/websocket.js
+3
-2
No files found.
src/stores/modules/websocket.js
View file @
f859370e
...
...
@@ -11,10 +11,12 @@ const useSocketStore = defineStore('socket', {
timerHeart
:
undefined
,
timerServerHeart
:
undefined
,
handClose
:
false
,
url
:
''
,
msg
:
''
,
}),
actions
:
{
connection
(
url
,
token
)
{
this
.
url
=
url
if
(
'WebSocket'
in
window
)
{
this
.
createWebSocket
(
url
,
token
);
}
else
{
...
...
@@ -93,7 +95,7 @@ const useSocketStore = defineStore('socket', {
//没连上会一直重连, 设置迟延,避免请求过多
this
.
timerReconnect
=
setTimeout
(()
=>
{
//setTimeout 到点了执行
this
.
connection
();
this
.
connection
(
this
.
url
);
this
.
lockReconnect
=
false
;
},
5000
);
},
...
...
@@ -135,7 +137,6 @@ const useSocketStore = defineStore('socket', {
console
.
log
(
'手动关闭ws'
);
this
.
handClose
=
true
;
this
.
clearTimer
();
console
.
log
(
'ws'
,
this
.
ws
);
if
(
this
.
ws
&&
this
.
ws
.
close
)
{
this
.
ws
.
close
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment