0

在 iview 表中,我的列:</p>

  export default {
    data () {
      return {
        columns5: [
          {
            title: 'CNAME',
            key: 'name',
            sortable: true
          },
          {
            title: 'nodes',
            key: 'nodes',
          },
          {
            title: 'domains',
            key: 'domains',
          },
          {
            title: 'desc',
            key: 'desc'
          },
          {
            title: 'duetime',
            key: 'duetime',
            sortable: true
          },
          {
            title: 'ctime',
            key: 'ctime',
            sortable: true
          },
          {
            title: 'uptime',
            key: 'uptime',
            sortable: true
          },
        ],

数据:

  anames:[
    {
        "id": 1,
        "nodes": [
            {
                "id": 1,
                "main_ip": "10.10.10.10",
                "ips": "10.10.10.10\r\n10.10.10.11",
                "req_secret": null,
                "ctime": "2021-05-17T09:41:53.159131+08:00",
                "uptime": "2021-05-17T10:31:47.886033+08:00",
                "cname": 1
            }
        ],
        "domains": [
            {
                "id": 1,
                "domain_name": "baidu.com",
                "ctime": "2021-05-17T16:19:18.097807+08:00",
                "uptime": "2021-05-17T16:19:18.097955+08:00",
                "cname": 1
            }
        ],
        "name": "masdcom",
        "desc": "",
        "desc_en": null,
        "is_active": true,
        "duetime": "2021-06-17T19:40:00+08:00",
        "ctime": "2021-05-17T09:13:57.019125+08:00",
        "uptime": "2021-05-17T19:42:23.025122+08:00",
        "user": 2
    }
]

你看到我的节点和域,在数据中anames它们是列表,而不仅仅是键值,我如何显示域的域名和节点的main_ip?

在里面不能用domains.domain_nameand nodes.main_ip

在此处输入图像描述

我希望节点显示所有节点的 main_ip,域显示所有域的 domain_name。我应该在列中做什么?

4

1 回答 1

0

域和节点是数组,您忘记了索引

domains[0].domain_namenodes[0].main_ip

于 2021-07-13T13:25:41.187 回答