js json生取key,value 值

时间:2020-05-22 17:36:25   收藏:0   阅读:58
       this.dataView = [];
            if (data.dataView && data.dataView != null) {
              let dataViewArr = JSON.parse(data.dataView);
              for (var key in dataViewArr) {
                this.dataView.push({
                  key: key,
                  value: dataViewArr[key]
                });
              }
            }
          <div v-if="dataView.length > 0">
                    <p v-for="item in dataView">
                      <span>{{item.key}}:</span>
                      {{item.value}}
                    </p>
                  </div>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!