logs: fix autoscrolling
This commit is contained in:
@@ -16,12 +16,10 @@
|
||||
</TopBar>
|
||||
</template>
|
||||
<template #body>
|
||||
<div class="logs-container" ref="logsContainer">
|
||||
<div v-for="line in logLines" :key="line.id" class="log-line">
|
||||
<span class="time">{{ line.time }}</span><span v-html="line.html"></span>
|
||||
</div>
|
||||
<div ref="scrollAnchor" class="bottom-spacer"></div>
|
||||
<div v-for="line in logLines" :key="line.id" class="log-line">
|
||||
<span class="time">{{ line.time }}</span><span v-html="line.html"></span>
|
||||
</div>
|
||||
<div ref="scrollAnchor" class="bottom-spacer"></div>
|
||||
</template>
|
||||
</MainLayout>
|
||||
</template>
|
||||
@@ -126,7 +124,8 @@ export default {
|
||||
this.logsModel.stream((id, time, html) => {
|
||||
this.logLines.push({ id, time, html});
|
||||
|
||||
const tmp = this.$refs.logsContainer;
|
||||
const tmp = document.getElementsByClassName('cloudron-layout-body')[0];
|
||||
if (!tmp) return;
|
||||
|
||||
const autoScroll = tmp.scrollTop > (tmp.scrollHeight - tmp.clientHeight - 34);
|
||||
if (autoScroll) setTimeout(() => this.$refs.scrollAnchor.scrollIntoView(false), 1);
|
||||
|
||||
Reference in New Issue
Block a user