<template>
    <el-menu
        :default-active="$route.path"
        router
    >
        <template v-for="item in menuList">
            <template v-if="item.children && item.children.length">
                <left-menu-item :key="item.id?.toString()" :menuItem="item"></left-menu-item>
            </template>
            <template v-else>
                <el-menu-item :key="item.id?.toString()" :index="item.url">
                    <span>{{ item.name }}</span>
                </el-menu-item>
            </template>
        </template>
    </el-menu>
</template>

<script setup>
    import LeftMenuItem from "./leftMenuItem.vue";
    const menuList = sessionStorage.getItem("userInfo") ? JSON.parse(sessionStorage.getItem("userInfo")).menus : [];
</script>

<style lang="less"></style>