diff --git a/app/wails/frontend/src/App.vue b/app/wails/frontend/src/App.vue
index 57bb944..39a9e1c 100644
--- a/app/wails/frontend/src/App.vue
+++ b/app/wails/frontend/src/App.vue
@@ -1,26 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -29,39 +20,10 @@
import {computed, onBeforeUnmount, onMounted} from "vue";
import {createDebugger, destroyDebugger} from "src/utils/debugger/eruda";
import {useGlobalConfig} from "src/store/globalConfig";
-import {useGlobalTabs} from "src/store/globalTabs";
-import {mapWritableState, storeToRefs} from "pinia";
-import {useRoute, useRouter} from "vue-router";
+import {mapWritableState} from "pinia";
const globalConfig = computed(mapWritableState(useGlobalConfig,['ui']).ui)
-const globalTabsState = useGlobalTabs()
-globalTabsState.$reset()
-
-const {tab:globalTab, tabs:globalTabs} = storeToRefs(globalTabsState)
-const router = useRouter()
-const route = useRoute()
-router.push({
- path: "/"
-})
-
-function tabChange(name){
- console.log("tabChange", name)
- router.push({
- path: name
- })
-}
-
-function tabRemove(name){
- let index = globalTabs.value.findIndex(item => item.name === name)
- if(index >= globalTabs.value.length){
- globalTab.value = globalTabs.value[0].name
- } else {
- globalTab.value = globalTabs.value[index+1].name
- globalTabs.value.splice(index,1)
- }
-}
-
onMounted(()=>{
createDebugger()
})
diff --git a/app/wails/frontend/src/components/scaffold/TabScaffold.vue b/app/wails/frontend/src/components/scaffold/TabScaffold.vue
new file mode 100644
index 0000000..21cc744
--- /dev/null
+++ b/app/wails/frontend/src/components/scaffold/TabScaffold.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/wails/frontend/src/router/router.js b/app/wails/frontend/src/router/router.js
index d905e12..ed549e4 100644
--- a/app/wails/frontend/src/router/router.js
+++ b/app/wails/frontend/src/router/router.js
@@ -7,18 +7,28 @@ import * as VueRouter from "vue-router"
const routes = [
{
path: '/',
- component: ()=>import("frontend/src/views/Home.vue"),
+ component: ()=>import("src/views/home/index.vue"),
meta: {
- title: "首页"
- }
+ title: "首页",
+ keepAlive: true,
+ },
+ children: [
+ {
+ path: "/home",
+ component: ()=>import("src/views/home/Home.vue"),
+ meta: {
+ title: "首页"
+ }
+ },
+ {
+ path: "/test",
+ component: ()=>import("src/views/home/Test.vue"),
+ meta: {
+ title: "测试"
+ }
+ }
+ ]
},
- {
- path: "/test",
- component: ()=>import("frontend/src/views/Test.vue"),
- meta: {
- title: "测试"
- }
- }
]
const Router = VueRouter.createRouter({
diff --git a/app/wails/frontend/src/store/globalTabs.js b/app/wails/frontend/src/store/globalTabs.js
index 87e46f6..c901621 100644
--- a/app/wails/frontend/src/store/globalTabs.js
+++ b/app/wails/frontend/src/store/globalTabs.js
@@ -2,10 +2,17 @@ import {defineStore} from "pinia";
export const useGlobalTabs = defineStore("globalTabs",{
state:()=>({
- tab: "/",
- tabs: [{
- name:"/",
- title: "首页"
- }]
- })
+ tab: "",
+ tabs: []
+ }),
+ actions:{
+ addTab(tab){
+ let index = this.tabs.findIndex(item => item.name === tab.name)
+ if( index === -1){
+ this.tabs.push(tab)
+ } else {
+ this.tabs[index] = Object.assign(this.tabs[index],tab)
+ }
+ }
+ }
})
diff --git a/app/wails/frontend/src/views/Home.vue b/app/wails/frontend/src/views/home/Home.vue
similarity index 94%
rename from app/wails/frontend/src/views/Home.vue
rename to app/wails/frontend/src/views/home/Home.vue
index 03b5492..ff25449 100644
--- a/app/wails/frontend/src/views/Home.vue
+++ b/app/wails/frontend/src/views/home/Home.vue
@@ -1,7 +1,7 @@
diff --git a/app/wails/frontend/src/views/Test.vue b/app/wails/frontend/src/views/home/Test.vue
similarity index 100%
rename from app/wails/frontend/src/views/Test.vue
rename to app/wails/frontend/src/views/home/Test.vue
diff --git a/app/wails/frontend/src/views/home/index.vue b/app/wails/frontend/src/views/home/index.vue
new file mode 100644
index 0000000..90139b7
--- /dev/null
+++ b/app/wails/frontend/src/views/home/index.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+