fix: log container not scroll to bottom

This commit is contained in:
0xJacky 2022-11-13 10:21:21 +08:00
parent 4bce9025af
commit 04bf6d78d4
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0

View file

@ -23,7 +23,7 @@ const control = reactive({
type: logType(), type: logType(),
conf_name: route.query.conf_name, conf_name: route.query.conf_name,
server_idx: parseInt(route.query.server_idx as string), server_idx: parseInt(route.query.server_idx as string),
directive_idx: parseInt(route.query.directive_idx as string), directive_idx: parseInt(route.query.directive_idx as string)
}) })
function openWs() { function openWs() {
@ -51,11 +51,12 @@ function addLog(data: string, prepend: boolean = false) {
} else { } else {
buffer.value += data buffer.value += data
} }
nextTick(() => {
const elem = (logContainer.value as any as Element) const elem = (logContainer.value as any as Element)
elem.scroll({ elem?.scroll({
top: elem.scrollHeight, top: elem.scrollHeight,
left: 0, left: 0
})
}) })
} }