前端和json优化

This commit is contained in:
2025-11-28 17:16:17 +08:00
parent 34e69c7f62
commit dfb11c85f1
135 changed files with 930 additions and 633 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="change-home" v-if="isAdmin">
<div class="change-home">
<div class="change-home-item" @click="changeHome">
<span v-if="home">前往用户页</span>
<span v-else>前往管理页</span>
@@ -10,14 +10,8 @@
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const isAdmin = ref<boolean>(false);
const home = ref<boolean>(false);
const router = useRouter();
const routes = router.getRoutes();
function hasAdmin(){
return routes.some((route: any) => route.path.startsWith('/admin'));
}
function changeHome(){
if(home.value){
@@ -27,10 +21,7 @@ function changeHome(){
}
home.value = !home.value;
}
onMounted(() => {
isAdmin.value = hasAdmin();
home.value = router.currentRoute.value.path.startsWith('/admin');
});
</script>
<style scoped lang="scss">
</style>