31 lines
956 B
Vue
Raw Normal View History

<script lang="ts" setup>
2022-11-07 17:44:48 +08:00
import { h, ref } from "vue"
import { useUserStore } from "@/store/modules/user"
import AdminDashboard from "./admin/index.vue"
import EditorDashboard from "./editor/index.vue"
2022-11-07 17:44:48 +08:00
import { ElNotification } from "element-plus"
2022-08-19 15:54:38 +08:00
type CurrentRoleType = "admin" | "editor"
const userStore = useUserStore()
const currentRole = ref<CurrentRoleType>("admin")
if (!userStore.roles.includes("admin")) {
currentRole.value = "editor"
}
2022-11-07 17:44:48 +08:00
ElNotification({
title: "Hello",
message: h(
"a",
{ style: "color: teal", target: "_blank", href: "https://github.com/un-pany/v3-admin-vite" },
"小项目获取 star 不易,如果你喜欢这个项目的话,欢迎点击这里支持一个 star !这是作者持续维护的唯一动力(小声:毕竟是免费的)"
),
duration: 0,
position: "bottom-right"
})
</script>
<template>
<component :is="currentRole === 'admin' ? AdminDashboard : EditorDashboard" />
</template>