var tmpl=`
    <el-checkbox-group :value="value" v-model="chks"  @change="onChange" :min="min" :max="max">
        <template v-if="!isButton">
            <el-checkbox v-for="item in chkMetaDatas" :label="item.key" :key="item.key">{{item.content}}</el-checkbox>
        </template>
        <template v-else>
            <el-checkbox-button v-for="item in chkMetaDatas" :label="item.key" :key="item.key">{{item.content}}</el-checkbox-button>
        </template>
    </el-checkbox-group>
`
module.exports=
`{
   template:'${tmpl}',
   model:{
     prop:"value",
     event:"change"
   },
   props:['value',"dicKey","isButton","min","max"],
   data:function(){
     return {
       chkMetaDatas:[
       ],
       chks:this.value,
     };
   },
   watch:{
     value:function(v){
        this.chks=v;
     }
   },
   mounted:function(){

   },
   created:function(){
      this.fetchMetaDatas();
   },
   methods:{
     onChange(chks){
       this.$emit("change",chks);
     },
     fetchMetaDatas:function(){
       this.$root.getReq("/web/metaCtl/getDicConfig",{"dicKey":this.dicKey}).then(cfg=>{
          console.log(JSON.stringify(cfg.data));
          Object.keys(cfg.data).forEach(key=>{
             this.chkMetaDatas.push({"key":key,"content":cfg.data[key]});
          });
       });
     },
   },
   vname:"gsb-checkgroup"
}`
