iView的Table的columns 数据的key,怎么才能是对象下面的数据呢?
我的意思是:
columns8: [
{
"title": "Name",
"key": "name",
"fixed": "left",
"width": 200
},
{
"title": "Show",
"key": "show",
"width": 150,
"sortable": true,
...
一般来说这个key是一个字符串,像上面这样.
传递数据的时候,我们传递table的data,像这样:
<table :data=data_list>
data_list 为下面这样:
[
{
name: 'a',
show: 'hello a',
...
},
{
name: 'b',
show: 'hello b',
...
},
{
name: 'c',
show: 'hello c',
...
}
]
但是,我有一个需求就是:
如果data_list像这样:
[
{
name: 'a',
obj: { show: 'hello a', }
...
},
{
name: 'b',
obj: { show: 'hello b', }
...
},
{
name: 'c',
obj: { show: 'hello c', }
...
}
]
这样应该怎么写table的 columns呢?
得到数据后,转化成iview的table所需要的格式