fix: update launch log after every switch

This commit is contained in:
tiny-craft 2023-08-02 19:42:05 +08:00
parent b852bb5b47
commit 72ac43594b
1 changed files with 14 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import ContentPane from './components/content/ContentPane.vue' import ContentPane from './components/content/ContentPane.vue'
import BrowserPane from './components/sidebar/BrowserPane.vue' import BrowserPane from './components/sidebar/BrowserPane.vue'
import { computed, reactive } from 'vue' import { computed, reactive, ref, watch } from 'vue'
import { debounce, get } from 'lodash' import { debounce, get } from 'lodash'
import { useThemeVars } from 'naive-ui' import { useThemeVars } from 'naive-ui'
import NavMenu from './components/sidebar/NavMenu.vue' import NavMenu from './components/sidebar/NavMenu.vue'
@ -24,6 +24,7 @@ const data = reactive({
const tabStore = useTabStore() const tabStore = useTabStore()
const prefStore = usePreferencesStore() const prefStore = usePreferencesStore()
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
const logPaneRef = ref(null)
// const preferences = ref({}) // const preferences = ref({})
// provide('preferences', preferences) // provide('preferences', preferences)
@ -55,11 +56,20 @@ const asideWidthVal = computed(() => {
const dragging = computed(() => { const dragging = computed(() => {
return data.hoverResize || data.resizing return data.hoverResize || data.resizing
}) })
watch(
() => tabStore.nav,
(nav) => {
if (nav === 'log') {
logPaneRef.value?.refresh()
}
},
)
</script> </script>
<template> <template>
<!-- app content--> <!-- app content-->
<div id="app-content-wrapper" :class="{ dragging }" class="flex-box-h" :style="prefStore.generalFont"> <div id="app-content-wrapper" :class="{ dragging }" :style="prefStore.generalFont" class="flex-box-h">
<nav-menu v-model:value="tabStore.nav" :width="data.navMenuWidth" /> <nav-menu v-model:value="tabStore.nav" :width="data.navMenuWidth" />
<!-- browser page--> <!-- browser page-->
<div v-show="tabStore.nav === 'browser'" class="flex-box-h flex-item-expand"> <div v-show="tabStore.nav === 'browser'" class="flex-box-h flex-item-expand">
@ -104,14 +114,12 @@ const dragging = computed(() => {
<!-- log page --> <!-- log page -->
<div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand"> <div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<keep-alive> <content-log-pane ref="logPaneRef" class="flex-item-expand" />
<content-log-pane class="flex-item-expand" />
</keep-alive>
</div> </div>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style lang="scss" scoped>
#app-content-wrapper { #app-content-wrapper {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;