js json生取key,value 值

       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>

 

posted @ 2020-05-22 16:28  abcByme  阅读(466)  评论(0编辑  收藏  举报