Commit bb498377 by 周田

fix:滚动条修改

parent fe3a0c2f
<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) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment