index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import Select from '../Select';
  4. export default class AnswerTable extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {};
  8. }
  9. componentWillMount() {}
  10. componentWillUnmount() {}
  11. render() {
  12. const { columns = [], data = [], list = [] } = this.props;
  13. return (
  14. <div className="answer-table">
  15. <div className="select-line">
  16. <Select size="basic" theme="default" list={list} />
  17. </div>
  18. <table border="1" bordercolor="#d8d8d8">
  19. <thead>
  20. <tr className="bg">
  21. {columns.map(item => {
  22. return <th>{item.title}</th>;
  23. })}
  24. </tr>
  25. </thead>
  26. <tbody>
  27. {data.map(row => {
  28. return (
  29. <tr>
  30. {columns.map(item => {
  31. return <td>{row[item.key]}</td>;
  32. })}
  33. </tr>
  34. );
  35. })}
  36. </tbody>
  37. </table>
  38. </div>
  39. );
  40. }
  41. }