summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpany <[email protected]>2023-06-16 18:12:53 +0800
committerpany <[email protected]>2023-06-16 18:12:53 +0800
commitc265e646762f27b7010211b9f17b0893360a28de (patch)
tree97c5db18c72f736cdc16e5a6644d64b746fc79e8 /src
parente8d0f9ba9d9277d2d4749dda19d40b97db0d5069 (diff)
perf: 代码优化 views/dashboard
Diffstat (limited to 'src')
-rw-r--r--src/views/dashboard/components/Admin.vue (renamed from src/views/dashboard/admin/index.vue)0
-rw-r--r--src/views/dashboard/components/Editor.vue (renamed from src/views/dashboard/editor/index.vue)0
-rw-r--r--src/views/dashboard/index.vue14
3 files changed, 4 insertions, 10 deletions
diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/components/Admin.vue
index 7964172..7964172 100644
--- a/src/views/dashboard/admin/index.vue
+++ b/src/views/dashboard/components/Admin.vue
diff --git a/src/views/dashboard/editor/index.vue b/src/views/dashboard/components/Editor.vue
index 2f369d6..2f369d6 100644
--- a/src/views/dashboard/editor/index.vue
+++ b/src/views/dashboard/components/Editor.vue
diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue
index c1f9316..a69624c 100644
--- a/src/views/dashboard/index.vue
+++ b/src/views/dashboard/index.vue
@@ -1,18 +1,12 @@
<script lang="ts" setup>
-import { ref } from "vue"
import { useUserStore } from "@/store/modules/user"
-import AdminDashboard from "./admin/index.vue"
-import EditorDashboard from "./editor/index.vue"
-
-type CurrentRole = "admin" | "editor"
+import Admin from "./components/Admin.vue"
+import Editor from "./components/Editor.vue"
const userStore = useUserStore()
-const currentRole = ref<CurrentRole>("admin")
-if (!userStore.roles.includes("admin")) {
- currentRole.value = "editor"
-}
+const isAdmin = userStore.roles.includes("admin")
</script>
<template>
- <component :is="currentRole === 'admin' ? AdminDashboard : EditorDashboard" />
+ <component :is="isAdmin ? Admin : Editor" />
</template>