如何从json获取数据并显示在表格中

时间:2018-10-29 09:56:51

标签: json reactjs react-redux

const CustomerInfo = [
    { id: "1", value: "9940572756", lastRecharge: "349", lastCallDuration: "09:58", lastCalledNumber: "9478369258", status: "Active" },
    { id: "2", value: "9874563210", lastRecharge: "110", lastCallDuration: "01:01:13", lastCalledNumber: "9632587410", status: "In Active" },
    { id: "3", value: "9517530258", lastRecharge: "500", lastCallDuration: "02:40", lastCalledNumber: "9362580147", status: "Active" }
]

我需要将其显示为具有提交按钮的形式,并且在将值称为电话号码时也需要在表格中显示

1 个答案:

答案 0 :(得分:-1)

render(){

return (
  <table>
  <tbody>{this.CustomerInfo.map(function(item, key) {

           return (
              <tr key = {key}>
                  <td>{item.id}</td>
                  <td>{item.value}</td>
                  <td>{item.lastRecharge}</td>
                  <td>{item.lastCallDuration}</td>
                  <td>{item.lastCalledNumber}</td>
              </tr>
            )

         })}</tbody>
   </table>
)

}