<template>
    <div class="menuItem">
        <template v-for="menu in this.menuData">
            <el-sub-menu :key="menu.index" :index="menu.index" v-if="menu.children"
                :disabled="menu.index === '' ? true : false">
                <img :src="menu.img">
                <template #title>
                    <!-- <i :class="menu.icon"></i> -->
                    <img :src="menu.img">
                    <span style="margin-left: 10px">{{menu.name}}</span>

                    <!-- <span slot="title">{{menu.name}}</span> -->
                </template>
                <menu-tree :menuData="menu.children"></menu-tree>
            </el-sub-menu>
            <el-menu-item :key="menu.index" :index="menu.index" :route="menu.index" v-else>
                <!-- <i :class="menu.icon"></i> -->
                <img :src="menu.img" alt="">
                <template #title>
                    <span style="margin-left: 10px">{{menu.name}}</span>
                </template>
                <!-- <span slot="title">{{menu.name}}</span> -->
            </el-menu-item>
        </template>
    </div>
</template>

<script>
    import MenuTree from '@/components/menuTreeconfig.vue'
    export default {
        components: [MenuTree],
        props: ['menuData'],
        name: 'MenuTree',
        methods: {}
    }
</script>

<style lang="less">
    .menuItem {
        img {
            width: 25px;
            height: 25px;
        }
    }
</style>