一、卡片Card分类

  • 与普通卡片使用区别:底部按钮及内容样式

    <Card
    hoverable
    bodyStyle={{ paddingBottom: 20 }}
    actions={[ // 卡片操作组,位置在卡片底部
    <Button size='large' onClick={() => this.showEditModal(item)}>修改</Button>,
    <Popconfirm title="是否要删除此孵化企业?" onConfirm={() => this.deleteItem(item)}>
    <Button type='danger' size='large'>删除</Button>
    </Popconfirm>
    ]}
    >
    <Card.Meta avatar={<Avatar size="small" src={`${setFileHost() + item.comLogo}`} />} title={item.comName} /> //头像、类名、描述等,位置在卡片左侧
    <div className={styles.cardItemContent}>
    <CardInfo
    productCount={item.productCount}
    />
    </div>
    </Card>

  • 动态添加卡片分类:List的dataSource数组第一个位置为空串,遍历时,遇到item渲染卡片,否则ListItem中包裹自定义按钮

    <List
    rowKey="id"
    loading={loading}
    grid={{ gutter: 24, lg: 3, md: 2, sm: 1, xs: 1 }}
    dataSource={['', ...list]} // 构建第一个位置为空串的list数组
    renderItem={item =>
    item ? (
    <List.Item key={item.id}>
    <Card hoverable className={styles.card}
    actions={[ <a onClick={() => this.editCategory(item)}>修改</a>,
    <Popconfirm title="是否要删除此分类?" onConfirm={() => this.deleteCategory(item)}>
    <a style={{color: 'red'}}>删除</a>
    </Popconfirm>
    ]}>
    <Card.Meta
    avatar={<img alt="" className={styles.cardAvatar} src={`${setFileHost() + item.categoryLogo }`} />}
    title={<a style={{ fontWeight: 600 }}>{item.categoryName}</a>}
    description={
    <Ellipsis className={styles.item} lines={3}>
    {`共 ${item.productCount}个商品`}
    </Ellipsis>
    }
    />
    </Card>
    </List.Item>
    ) : (
    <List.Item> // 空串位置 渲染按钮
    <Button type="dashed" className={styles.newButton} onClick={() => this.addCategory()}>
    <Icon type="plus" /> 新增分类
    </Button>
    </List.Item>
    )
    />

  

二、分布表单

  • <Step/>步骤条组件的使用,current指定当前步骤,从 0 开始记数

    export default class StepForm extends PureComponent {
    getCurrentStep() {
    const { location } = this.props;
    const { pathname } = location;
    const pathList = pathname.split('/');
    switch (pathList[pathList.length - 1]) {
    case 'info':
    return 0;
    case 'confirm':
    return 1;
    case 'result':
    return 2;
    default:
    return 0;
    }
    } render() {
    const { location, children } = this.props; return (
    <PageHeaderWrapper
    title="分步表单"
    tabActiveKey={location.pathname}
    content="将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成。"
    >
    <Card bordered={false}>
    <Fragment>
    <Steps current={this.getCurrentStep()} className={styles.steps}>
    <Step title="填写转账信息" />
    <Step title="确认转账信息" />
    <Step title="完成" />
    </Steps>
    {children} // 可直接写为三个状态对应的三个表单子组件
    </Fragment>
    </Card>
    </PageHeaderWrapper>
    );
    }
    }

    有个疑问:框架自带Mock页面Form->StepForm->index.js、step1.js、step2.js、step3.js实现切换表单的方式还没弄明白。。。 


注:转载请注明出处

最新文章

  1. [deviceone开发]-小草用户分享的Listview停靠的示例
  2. C++设计模式——简单工厂模式
  3. 【knowledgebase】不要在一个很大的RDD上调用collect
  4. 从你的u盘启动:30天自制操作系统第四天u盘启动学习笔记
  5. COJ 0026 汉诺塔问题
  6. RenderBody, RenderPage and RenderSection methods in MVC 3
  7. jsp中获取json字符串,并解析
  8. iOS拨打电话
  9. WPF 自定义图表(柱状图,曲线图)
  10. Vue基本使用
  11. Android中自定义广播的实现
  12. Let Encrypt延期(转自虞大胆的叽叽喳喳)
  13. 使用NetBox实现ASP网页封装为EXE教程
  14. linux ping命令
  15. cqlsh 一个错误
  16. 【问题定位】tcpdump 抓包简易命令
  17. Croc Champ 2013 - Round 1 E. Copying Data 线段树
  18. shell命令技巧——文本去重并保持原有顺序
  19. ZT ANDROID jni 中的事件回调机制JNIenv的使用 2012-09-10 12:53:01
  20. fatal: read error: Connection reset by peer解决办法

热门文章

  1. npm 关联 git包
  2. luogu P4382 [九省联考2018]劈配
  3. jse中将数据反转
  4. BFC的概念、BFC触发方式、BFC作用介绍
  5. 利用ab压力工具对服务器进行压力测试
  6. python之kafka消费
  7. 使用django+rpc进行服务内部交互
  8. ubuntu 安装nginx redis dotnet
  9. Shiro(一)
  10. git概述(一)