diff --git a/ui/src/App.vue b/ui/src/App.vue index cffa4df..eb2e815 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -34,15 +34,19 @@ async function initialize_config() { await init_version() } -const log = ref('') +const log = ref([]) provide('log', log) const log_ele = ref(null) provide('log_ele', log_ele) -watch(log, () => { - nextTick(() => { - log_ele.value?.scrollTo({ position: 'bottom' }) - }) -}) +watch( + log, + () => { + nextTick(() => { + log_ele.value?.scrollTo({ position: 'bottom' }) + }) + }, + { deep: true } +) onMounted(() => { if (window.pywebview && pywebview.api) { @@ -53,12 +57,15 @@ onMounted(() => { }) } window.addEventListener('log', (e) => { - log.value += e.detail.log + log.value.push(e.detail.log) + if (log.value.length > 200) { + log.value.shift() + } }) }) function set_page(value) { - log.value = '' + log.value.splice(0) } const running = ref(false) diff --git a/ui/src/components/FloatButton.vue b/ui/src/components/FloatButton.vue index 06f16c1..de0ff86 100644 --- a/ui/src/components/FloatButton.vue +++ b/ui/src/components/FloatButton.vue @@ -11,7 +11,7 @@ const current_state = inject('current_state') const notification = useNotification() async function start() { - log.value = '' + log.value = [] running.value = true for (const [i, step] of steps.value.entries()) { current_step.value = i + 1 diff --git a/ui/src/components/LogComponent.vue b/ui/src/components/LogComponent.vue index 47d1339..b16c676 100644 --- a/ui/src/components/LogComponent.vue +++ b/ui/src/components/LogComponent.vue @@ -51,7 +51,7 @@ hljs.registerLanguage('naive-log', () => ({