The Menu menu in iview does not display the parent menu when there is only one parent menu. How to solve it? I think it all shows

clipboard.png

clipboard.png

=

< style lang= "less" >

@import "../styles/menu.less";

< / style >

< template >

<Menu ref="sideMenu" :active-name="$route.name" :open-names="openNames" :theme="menuTheme" width="auto" @on-select="changeMenu">
    <template v-for="item in menuList">
        <MenuItem v-if="item.children.length<=1" :name="item.children[0].name" :key=""menuitem" + item.name">
            <Icon :type="item.children[0].icon || item.icon" :size="iconSize" :key=""menuicon" + item.name"></Icon>
            <span class="layout-text" :key=""title" + item.name">{{ itemTitle(item.children[0]) }}</span>
        </MenuItem>

        <Submenu v-if="item.children.length > 1" :name="item.name" :key="item.name">
            <template slot="title">
                <Icon :type="item.icon" :size="iconSize"></Icon>
                <span class="layout-text">{{ itemTitle(item) }}</span>
            </template>
            <template v-for="child in item.children">
                <MenuItem :name="child.name" :key=""menuitem" + child.name">
                    <Icon :type="child.icon" :size="iconSize" :key=""icon" + child.name"></Icon>
                    <span class="layout-text" :key=""title" + child.name">{{ itemTitle(child) }}</span>
                </MenuItem>
            </template>
        </Submenu>
    </template>
</Menu>

< / template >

< script >
export default {

name: "sidebarMenu",
props: {
    menuList: Array,
    iconSize: Number,
    menuTheme: {
        type: String,
        default: "dark"
    },
    openNames: {
        type: Array
    }
},
methods: {
    changeMenu (active) {
        this.$emit("on-change", active);
    },
    itemTitle (item) {
        if (typeof item.title === "object") {
            return this.$t(item.title.i18n);
        } else {
            return item.title;
        }
    }
},
updated () {
    this.$nextTick(() => {
        if (this.$refs.sideMenu) {
            this.$refs.sideMenu.updateOpened();
        }
    });
}

};
< / script >

Mar.22,2021

v-if


clipboard.png

that's fine

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdef50-31431.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdef50-31431.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?