How to write complex iView table columns?

how can the key, of the columns data of Table of

iView be the data under the object?

I mean:



  columns8: [
            {
                "title": "Name",
                "key": "name",
                "fixed": "left",
                "width": 200
            },
            {
                "title": "Show",
                "key": "show",
                "width": 150,
                "sortable": true,
            ...

generally speaking, this key is a string, like above.
when passing data, we pass the data, of table like this:

<table :data=data_list>                

data_list is as follows:

 [
      {
        name: "a",
        show: "hello a",
        ...  
      },
      {
        name: "b",
        show: "hello b",
        ...  
      },
      {
        name: "c",
        show: "hello c",
        ...  
      }
    ]

however, I have a requirement:

if data_list is like this:

         
 [
      {
        name: "a",
        obj: { show: "hello a", }
        ...  
      },
      {
        name: "b",
        obj: { show: "hello b", }
        ...  
      },
      {
        name: "c",
        obj: { show: "hello c", }
        ...  
      }
    ]

how should I write the columns of table?

Mar.05,2021

the format needed to convert the data into iview's table


use the render function,

{
    title: 'Show',
    key: 'Show',
    align: 'center',
    render: (h, params) => params.row.obj.show
}
Menu