Skip to content

Commit 04bf6d7

Browse files
committed
fix: log container not scroll to bottom
1 parent 4bce902 commit 04bf6d7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

frontend/src/views/nginx_log/NginxLog.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const control = reactive({
2323
type: logType(),
2424
conf_name: route.query.conf_name,
2525
server_idx: parseInt(route.query.server_idx as string),
26-
directive_idx: parseInt(route.query.directive_idx as string),
26+
directive_idx: parseInt(route.query.directive_idx as string)
2727
})
2828
2929
function openWs() {
@@ -51,11 +51,12 @@ function addLog(data: string, prepend: boolean = false) {
5151
} else {
5252
buffer.value += data
5353
}
54-
55-
const elem = (logContainer.value as any as Element)
56-
elem.scroll({
57-
top: elem.scrollHeight,
58-
left: 0,
54+
nextTick(() => {
55+
const elem = (logContainer.value as any as Element)
56+
elem?.scroll({
57+
top: elem.scrollHeight,
58+
left: 0
59+
})
5960
})
6061
}
6162

0 commit comments

Comments
 (0)