Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue_django_test
Overview
Overview
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
周田
vue_django_test
Commits
bb498377
Commit
bb498377
authored
Aug 16, 2023
by
周田
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:滚动条修改
parent
fe3a0c2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
Chat.vue
frontend/src/views/Chat.vue
+7
-11
No files found.
frontend/src/views/Chat.vue
View file @
bb498377
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
,
onUpdated
}
from
'vue'
;
import
{
ref
,
onMounted
,
watch
}
from
'vue'
;
import
{
ElScrollbar
,
ElInput
,
ElButton
}
from
'element-plus'
;
const
innerRef
=
ref
<
HTMLDivElement
>
();
...
...
@@ -14,7 +14,7 @@ const items = ref<string[]>([
'{"interface_id":"IID_OAM_Server_HistoryPerformance","dst_suid":285540352,"src_suid":285474816,"priority":100,"ts":"2023-08-08T08:16:14.224831Z","parameters":[{"@type":"type.googleapis.com/RequireHistoryPerformance","station_id":286261248,"start_time":"2023-07-17 02:27:44","end_time":"2023-07-17 02:39:07"}],"forward_flag":0,"request_index":"0","operations_type":0}'
,
'{"interface_id":"IID_OAM_Server_HistoryPerformance","dst_suid":285540352,"src_suid":285474816,"priority":100,"ts":"2023-08-08T08:16:14.224831Z","parameters":[{"@type":"type.googleapis.com/RequireHistoryPerformance","station_id":286261248,"start_time":"2023-07-17 02:27:44","end_time":"2023-07-17 02:39:07"}],"forward_flag":0,"request_index":"0","operations_type":0}'
,
]);
//
const flag = ref
<
boolean
>
(
false
);
const
flag
=
ref
<
boolean
>
(
false
);
let
chatSocket
:
WebSocket
|
null
=
null
;
...
...
@@ -29,16 +29,12 @@ const send = () => {
input
.
value
=
''
;
}
onUpdated
(()
=>
{
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
offsetHeight
);
watch
(
flag
,
()
=>
{
setTimeout
(()
=>
{
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
offsetHeight
);
},
50
);
});
// watch(flag, () => {
// setTimeout(() => {
// scrollbarRef.value!.setScrollTop(innerRef.value!.offsetHeight);
// }, 50);
// });
onMounted
(()
=>
{
chatSocket
=
new
WebSocket
(
'ws://'
...
...
@@ -55,7 +51,7 @@ onMounted(() => {
// const message = byteArray.toString();
// items.value.push(JSON.stringify(e.data));
items
.
value
.
push
(
e
.
data
);
//
flag.value = !flag.value
flag
.
value
=
!
flag
.
value
};
chatSocket
.
onclose
=
(
e
)
=>
{
...
...
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