<template>
    <div>
        <Menu ref="menu" mode="horizontal" :active-name="selectedItemName"  v-model="this.threeLevel[0].id">
            <MenuItem :name="cItem.id" :to="cItem.resource" v-for="cItem in threeLevel"
                      :key="cItem.id">
                {{cItem.name}}
            </MenuItem>
        </Menu>
        <div>
            <router-view/>
        </div>
    </div>
</template>

<script>
    export default {
        name: "ShopIncrease",
        data() {
            return {
                threeLevel: [],
                selectedItemName: null,
            }
        },
        created() {
            this.threeLevel = JSON.parse(sessionStorage.getItem("threeLevel"));
            this.menuInit();
        },
        mounted() {
            this.threeLevel = JSON.parse(sessionStorage.getItem("threeLevel"));
            this.menuInit();
        },
        methods:{
            menuInit(){
                let that = this;
                that.selectedItemName = that.threeLevel[0].id;
                this.$nextTick(() => {
                    that.$refs.menu.updateActiveName();
                });
            }
        }
    }
</script>

<style scoped>

</style>
