vue v-for列表、json渲染

2019-07-11  本文已影响0人  头脑之外
       <div class="top3-content" v-for="(key,dataMapName) in data"> 
          <el-row>
            <el-col :span="24" class="top">
              <span class="left-circle-icon"></span>
              <span>{{dataMapName}}</span>
            </el-col>
          </el-row>
          <el-row v-for="v in key">
            <div class="top-content">
              <span class="gray-span">{{v.name}}:</span>
              <span class="main-span">{{v.value}}</span>
            </div>
          </el-row>
        </div>
methods: {
    getCurrent(){
      getCurrent().then(res => {
        let _this = this;
        const data = res.data.data; // arr
        _this.data = data.dataMap; // json
        _this.tenantCode = data.tenantCode;
        _this.systemName = data.systemName;
        _this.contactNumber = data.contactNumber;
        _this.linkman = data.linkman;
        for (var key in _this.data) {
          console.log(key + "," + _this.data[key].length);
        }
      }).catch(error => {
        this.$message.error(new Error("报错啦!"));
      });
    }
上一篇下一篇

猜你喜欢

热点阅读