var tmpl=`
<el-menu  style="border:none"
 :collapse="collapse"
 default-active="1"
 background-color="white"
 text-color="#4600FF"
 active-text-color="#ffd04b"
 @select="onselectMenu"
>
  <template v-for="treeItem in rsData">
      <el-submenu :index="treeItem.code" v-if="treeItem.isSubmenu && !treeItem.hidden" :index="treeItem.code">
         <template slot="title">
           <i   v-if="treeItem.icon" :class="treeItem.icon"  style="font-size:28px"></i>
           <img v-if="!treeItem.icon" class="el-icon-menu" style="width:30px;height:30px" :src="format(treeItem)"></img>
           <span>{{treeItem.label}}</span>
         </template>
         <template v-for="subItem in treeItem.children">
           <el-menu-item-group :index="subItem.code" v-if="subItem.isGroup && !subItem.hidden">
               <template slot="title">
                 <i   v-if="subItem.icon" :class="subItem.icon"  style="font-size:28px"></i>
                 <img v-if="!subItem.icon" class="el-icon-menu" :src="format(subItem)"></img>
                 <span>{{format(subItem,subItem.label)}}</span>
               </template>
              <el-menu-item v-if="groupItem.isMenu==true && !groupItem.hidden" :index="groupItem.path" v-for="groupItem in subItem.children">
                  {{format(groupItem,groupItem.label)}}
              </el-menu-item>
           </el-menu-item-group>
         </template>
      </el-submenu>
      <el-menu-item v-if="treeItem.isMenu==true && treeItem.hidden==false" :index="treeItem.path?treeItem.path:treeItem.bizCode">
          <i v-if="treeItem.icon" :class="treeItem.icon" style="font-size:28px"></i>
          <img v-if="!treeItem.icon" class="el-icon-menu" :src="format(treeItem)"></img>
          <span slot="title" class="nav_color">{{treeItem.label}}</span>
      </el-menu-item>
  </template>
</el-menu>
`
module.exports=
`{
   template:'${tmpl}',
   props:['formatprop',"collapse"],
   data:function(){
     return {
        rsData:[],
     };
   },
   mounted:function(){

   },
   created:function(){

   },
   methods:{
     fetchMetaData:function(){
       this.$root.getReq("/web/metaCtl/getRsConfig",null).then(cfg=>{
          if(cfg){
            this.rsData=[];
            cfg.data.children.forEach(r=>{
              this.rsData.push(r);
            })
          }
       });
     },
     onselectMenu:function(index,indexPath){
        this.$emit("menuselect",index);
     },
     format:function(treeItem,label){
       return this.$root[this.formatprop](treeItem,label);
     }
   },
   vname:"gsb-menu"
}`
