react 组件创建
/** * 数据屏蔽 * Created by 2016-12-02. */ import React, {Component} from 'react'; export default class DataMaskingMain extends Component { render() { return ( <div> 开发中…… </div> ) } }
//定义一个组件
renderData = (history, xyml, columns, dataSource) => { if (!history.id || !xyml.itemId) { return <div style={{textAlign: 'center',marginTop: 30}}>暂无数据</div>; } else return ( <Table bordered size="small" columns={columns} dataSource={dataSource} pagination={false}/> ) }; //================= render() { return ( <div> <div className="block-box-header"> <div className="block-box-body">
//调用组件
{this.renderData(history, xyml, columns, dataSource)} </div> </div> </div> ); }