-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: π§βπ» Improve application performance with VueRouter
- Loading branch information
Showing
74 changed files
with
156 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,4 @@ dist | |
dist-ssr | ||
dist-electron | ||
dist-release | ||
components.d.ts | ||
auto-imports.d.ts | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div | ||
class="absolute inset-0 h-full flex flex-col px-4 pb-4 pt-1 space-y-4 overflow-hidden" | ||
> | ||
<div | ||
class="flex items-center flex-none border-b border-gray-200 dark:border-gray-700 pb-1" | ||
> | ||
<div class="flex-none"> | ||
<el-segmented | ||
v-slot="{ item }" | ||
v-model="activeTab" | ||
:options="tabsModel" | ||
> | ||
<div class=""> | ||
{{ $t(item.label) }} | ||
</div> | ||
</el-segmented> | ||
</div> | ||
<div class="flex-1 w-0 flex items-center justify-end"> | ||
<QuickBar /> | ||
</div> | ||
</div> | ||
|
||
<div class="flex-1 h-0 overflow-auto"> | ||
<RouterView v-slot="{ Component }"> | ||
<keep-alive> | ||
<component :is="Component" /> | ||
</keep-alive> | ||
</RouterView> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ElMessageBox } from 'element-plus' | ||
import QuickBar from '$/components/QuickBar/index.vue' | ||
import { computed } from 'vue' | ||
const router = useRouter() | ||
const route = useRoute() | ||
const tabsModel = [ | ||
{ | ||
label: 'device.list', | ||
value: '/device', | ||
}, | ||
{ | ||
label: 'preferences.name', | ||
value: '/preference', | ||
}, | ||
{ | ||
label: 'about.name', | ||
value: '/about', | ||
}, | ||
] | ||
const activeTab = computed({ | ||
get() { | ||
return route.path | ||
}, | ||
set(value) { | ||
router.push(value) | ||
}, | ||
}) | ||
provide('activeTab', activeTab) | ||
</script> | ||
|
||
<style lang="postcss" scoped> | ||
:deep() { | ||
.el-segmented { | ||
--el-border-radius-base: 5px; | ||
--el-segmented-bg-color: transparent; | ||
--el-segmented-item-selected-bg-color: var(--el-color-primary-light-9); | ||
--el-segmented-item-selected-color: rgba(var(--color-primary-500), 1); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<component :is="activeLayout" class=""></component> | ||
</template> | ||
|
||
<script setup> | ||
import DefaultLayout from './default/index.vue' | ||
const LayoutMap = { | ||
default: DefaultLayout, | ||
} | ||
const route = useRoute() | ||
const activeLayout = computed(() => LayoutMap[route.meta.layout || 'default']) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import bootstrap from './bootstrap/index.js' | ||
|
||
import { router } from './router' | ||
import App from './App.vue' | ||
|
||
bootstrap(App) | ||
bootstrap(App, { router }) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.