@@ -3,13 +3,18 @@ import { ref } from 'vue'
33import SerialConfig from ' ./components/SerialConfig.vue'
44import SerialLog from ' ./components/SerialLog.vue'
55import Chart3D from ' ./components/Chart3D.vue'
6+ import ChartPanel from ' ./components/ChartPanel.vue'
67import DataTable from ' ./components/DataTable.vue'
78import SerialQuickSend from ' ./components/SerialQuickSend.vue'
89import SerialScripts from ' ./components/SerialScript.vue'
910import { useDark , useToggle } from ' @vueuse/core'
1011// @ts-ignore
1112import { Splitpanes , Pane } from ' splitpanes'
1213import ' splitpanes/dist/splitpanes.css'
14+ import { ConfigManager } from ' ./utils/ConfigManager'
15+
16+ const configManager = ConfigManager .getInstance ()
17+ const layoutConfig = configManager .useConfig (' layout' )
1318
1419const isDark = useDark ({
1520 initialValue: ' dark' ,
@@ -28,14 +33,33 @@ const toggleFullscreen = () => {
2833 isFullscreen .value = false
2934 }
3035}
36+
37+ const handleSplitResize = (options : { size: number }[]) => {
38+ layoutConfig .value .splitPaneSize = options [0 ].size
39+ handleResize ()
40+ }
41+
42+ const handleTabChange = () => {
43+ handleResize ()
44+ }
45+
46+ let resizeTimer: number
47+ const handleResize = () => {
48+ clearTimeout (resizeTimer )
49+ resizeTimer = setTimeout (() => {
50+ window .dispatchEvent (new CustomEvent (' resize' , { }))
51+ }, 100 )
52+ }
53+ handleResize ()
54+
3155 </script >
3256
3357<template >
3458 <el-container class =" app-container" >
3559 <el-header class =" app-header" >
3660 <div class =" header-content" >
3761 <div class =" header-left" >
38- <h1 ><a href =" https://github.com/qdsang/web-serial" target =" _blank" >Web Serial</a ></h1 >
62+ <h1 ><a href =" https://github.com/qdsang/web-serial-debug " target =" _blank" >Web Serial</a ></h1 >
3963 <SerialConfig class =" header-serial-config" />
4064 </div >
4165 <div class =" header-links" >
@@ -51,27 +75,29 @@ const toggleFullscreen = () => {
5175 circle
5276 @click =" toggleFullscreen()"
5377 />
54- <a href =" https://github.com/qdsang/web-serial" target =" _blank" >Github</a >
5578 </div >
5679 </div >
5780 </el-header >
5881 <el-container class =" main-container" >
59- <Splitpanes class =" default-theme" >
60- <Pane :size =" 75 " class =" w75" >
61- <el-tabs type =" card" class =" lv-card lv-tabs" >
62- <el-tab-pane label =" 日志" >
82+ <Splitpanes class =" default-theme" @resize = " handleSplitResize " >
83+ <Pane :size =" layoutConfig.splitPaneSize " class =" w75" >
84+ <el-tabs type =" card" class =" lv-card lv-tabs" v-model = " layoutConfig.leftActiveTab " @tab-click = " handleTabChange " >
85+ <el-tab-pane label =" 日志" lazy >
6386 <SerialLog />
6487 </el-tab-pane >
65- <el-tab-pane label =" 图表" lazy >
88+ <el-tab-pane label =" 可视化" lazy >
89+ <ChartPanel />
90+ </el-tab-pane >
91+ <el-tab-pane label =" 姿态" lazy >
6692 <Chart3D />
6793 </el-tab-pane >
6894 <el-tab-pane label =" 数据表" >
6995 <DataTable />
7096 </el-tab-pane >
7197 </el-tabs >
7298 </Pane >
73- <Pane :size = " 25 " :min-size = " 10 " :max-size = " 80 " class =" w25" >
74- <el-tabs type =" card" class =" lv-card lv-tabs" >
99+ <Pane class =" w25" >
100+ <el-tabs type =" card" class =" lv-card lv-tabs" v-model = " layoutConfig.rightActiveTab " >
75101 <el-tab-pane label =" 快捷发送" >
76102 <SerialQuickSend />
77103 </el-tab-pane >
@@ -222,6 +248,8 @@ html.dark .el-button {
222248 margin : 8px 0 0 8px ;
223249 padding : 0px 6px ;
224250 height : 24px ;
251+ transition : all .1s ;
252+ user-select :none ;
225253 }
226254 & .el-tabs.el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
227255 background-color : #f5f5f5 ;
0 commit comments