方法一
{{key}}
{{tableData[scope.$index][key]}}
方法二
{{scope.row[key]}}
方法一 方法二 的数据结构
data() {
return {
value: "",
tableData: [
{
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄"
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄"
},
{
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄"
},
{
date: "2016-05-03",
name: "王小虎",
address: "上海市普陀区金沙江路 1516 弄"
}
]
};
},
方法三
{{scope.row[item.id]}}
tableDatas: {
fields: [
{
id: "date",
name: "时间"
},
{
id: "name",
name: "名字"
},
{
id: "address",
name: "地址"
}
],
tableData: [
{
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄"
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄"
},
{
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄"
},
{
date: "2016-05-03",
name: "王小虎",
address: "上海市普陀区金沙江路 1516 弄"
}
]
},
参考:对象属性键值 [key] 属性问题
var obj = { key: 0, key1: 1, key2: 2, key3: 3 };
console.log(obj["key3"]);
console.log(obj.key3);