update
This commit is contained in:
@@ -1,32 +1,31 @@
|
||||
<script setup>
|
||||
import {onMounted} from "vue";
|
||||
import mockRoutes from "./mock.js";
|
||||
import routesMap from "../../router/routes-map.js";
|
||||
import {toPath} from "../../utils/index.js";
|
||||
import {useSystemStore} from "../../pinia/SystemStore/index.js";
|
||||
|
||||
const SystemStore = useSystemStore();
|
||||
|
||||
onMounted(() => {
|
||||
console.log(mockRoutes.map(v => ({
|
||||
path: v.path,
|
||||
name: v.name,
|
||||
component: routesMap[v.component]
|
||||
})))
|
||||
});
|
||||
|
||||
const menuItemClick = (e) => {
|
||||
toPath(`/home${e}`);
|
||||
}
|
||||
//--main-bg-color
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-menu @menu-item-click="menuItemClick">
|
||||
<a-sub-menu v-for="item in mockRoutes" :key="item.name">
|
||||
<template #icon>
|
||||
<icon-apps></icon-apps>
|
||||
</template>
|
||||
<template #title>{{ item.title }}</template>
|
||||
<a-menu-item v-for="k in item.children" :key="item.path + k.path">{{k.title}}</a-menu-item>
|
||||
</a-sub-menu>
|
||||
</a-menu>
|
||||
<div class="w-full h-full box-border">
|
||||
<a-menu @menu-item-click="menuItemClick">
|
||||
<a-sub-menu v-for="item in SystemStore.RoutesTemp" :key="item.name">
|
||||
<template #icon>
|
||||
<icon-apps></icon-apps>
|
||||
</template>
|
||||
<template #title>{{ item.title }}</template>
|
||||
<a-menu-item v-for="k in item.children" :key="`/${item.path}/${k.path}`">{{ k.title }}</a-menu-item>
|
||||
</a-sub-menu>
|
||||
</a-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
const mockRoutes = [
|
||||
{
|
||||
path: 'task-center',
|
||||
name: 'task-center',
|
||||
title: '任务中心',
|
||||
icon: '',
|
||||
component: 'task-center',
|
||||
children: [
|
||||
{
|
||||
path: 'reward-mission',
|
||||
name: 'reward-mission',
|
||||
title: '悬赏任务',
|
||||
icon: '',
|
||||
component: 'reward-mission',
|
||||
},
|
||||
{
|
||||
path: 'appointed-task',
|
||||
name: 'appointed-task',
|
||||
title: '任务指派',
|
||||
icon: '',
|
||||
component: 'appointed-task',
|
||||
}
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
export default mockRoutes;
|
||||
Reference in New Issue
Block a user