我已经设置了这个 js 对象:
var tableTypes = {
"stockRcmnd":{
"name":"stockRcmnd",
"columns": ['1','2', '3']
},
"stockChange":{
"name":"stockChange",
"columns": ['4','5', '6']
}
};
现在,我想动态获取列:
property = "stockChange";
columns = tableTypes.{property}.columns;
property = "stockRcmnd";
columns = tableTypes.{property}.columns;
这是一个jsfiddle;
知道怎么做吗?