/**
 * 钟是志
 * 2019年9月4日
 * 列表字段渲染
 * */
import React, {Component, Fragment} from 'react';
import styles from './index.less';
import PropTypes from 'prop-types';

const FieldList = (props) => {
  const { data, config } = props;
  return (
    <div>
      {
        config.map((x) =>{
          return (
            <p className={styles.detailInfo} key={x.key}>
              <span>{x.name}</span>
              <span>{data[x.key] || ''}</span>
            </p>
          );
        })
      }
    </div>
  );
};

FieldList.propTypes = {
  data: PropTypes.object.isRequired,          //数据
  config: PropTypes.array.isRequired,  // 配置项
};
FieldList.defaultProps = {
  data: {},
  config: [],
};

export default FieldList;
