导语
封装一个card的组件
编辑
核心代码
// 列表table的参数 export const tableListConfig = { MARGIN_TOP: 16, PADDING: 16, };
import React, { Component } from 'react'; import { Card } from 'antd'; import { tableListConfig } from '../../config/index'; /** * 统一 列表 Card 样式 */ export const TableCard = (props = {}) => { const { rootStyle = {}, ...restProps } = props; return ( <Card style={{ marginTop: tableListConfig.MARGIN_TOP, ...rootStyle }} bodyStyle={{ padding: tableListConfig.PADDING }} {...restProps} > {props.children} </Card> ); };
总结
以上代码 这样就能使用了