【问题标题】:formatting json file with vue.js使用 vue.js 格式化 json 文件
【发布时间】:2018-06-18 08:44:45
【问题描述】:

如何使用 vue.js 显示 json 文件的输出 这是我的例子:

access_type: {
    "id": 1210765901,
    "version": "17",
    "creation_time": "2015-04-02 15:09:02",
    "change_time": "2017-01-06 02:51:01",
    "fixnet_id": "BN00002969937",
    "status": "ACTIVE",
    "xipsib_lan_ip": null
}

我想这样输出:

id: 1210765901
version: 17
...

这是我的脚本:

<div class="card-content">
    <pre v-for="(info, index) in activeInfos" :key="index">
        <li>{{ type }}: {{ info}}</li> 
    </pre>
</div>

【问题讨论】:

  • 当前代码有什么问题?
  • @evolutionxbox 我有输出,比如我展示的示例,我想格式化结果
  • 什么样的格式?
  • @choasia 结果是这样的: id: 1210765901 也不像这样 "id": 1210765901
  • 你把json数据转换成对象了吗?

标签: javascript json vue.js


【解决方案1】:

感谢您的帮助 我找到了解决方案:

<vue-tabs class="row" direction="vertical" value="Description">
          <div v-for="(siteParts, index) in sitePartLine">
            <v-tab :title="sitePartLine[index].serial_no" v-if="sitePartLine[index]">
              <div class="description text-left" v-for="siteParts in sitePartLine">
                {{ siteParts.fixnet_id }}
                <div class="description text-left" v-for="item in siteParts.part_attributes">
                  <small><strong>{{item.x_name}}</strong> {{item.x_value}}</small>
                </div>
              </div>
            </v-tab>
          </div>

        </vue-tabs>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-02
    相关资源
    最近更新 更多