mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-12-28 02:55:58 +08:00
30 lines
760 B
Vue
30 lines
760 B
Vue
<script lang="ts" setup>
|
|
import { computed } from "vue";
|
|
import { useRoute } from "vue-router";
|
|
import router from "@/router";
|
|
import showMenu from "@/router/menu";
|
|
|
|
defineProps({
|
|
width: {
|
|
type: [Number, String],
|
|
default: 200,
|
|
},
|
|
});
|
|
const route = useRoute();
|
|
const goto = (name: string) => router.push({ name });
|
|
const selectedKeys = computed(() => [route.name]);
|
|
|
|
</script>
|
|
<template>
|
|
<ALayoutSider :style="{ width, height: '100%' }">
|
|
<AMenu :selected-keys="selectedKeys" @menu-item-click="goto">
|
|
<AMenuItem v-for="item in showMenu" :key="item.name">
|
|
<template #icon>
|
|
<component :is="item.meta?.icon" />
|
|
</template>
|
|
{{ item.meta.title }}
|
|
</AMenuItem>
|
|
</AMenu>
|
|
</ALayoutSider>
|
|
</template>
|