From dcb5f76751624f1f9386d05c90a92402709fce38 Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Thu, 28 Sep 2017 11:18:32 +0800 Subject: [PATCH] update antd3.0 --- src/index.less | 2 + src/routes/List/BasicList.js | 32 ++++++++-------- src/routes/List/CardList.js | 51 +++++++++++++------------- src/routes/List/CoverCardList.js | 61 +++++++++++++++---------------- src/routes/List/FilterCardList.js | 51 +++++++++++++------------- src/routes/List/SearchList.js | 51 +++++++++++++++----------- 6 files changed, 127 insertions(+), 121 deletions(-) diff --git a/src/index.less b/src/index.less index 06d5f3e5..42b4d6cc 100644 --- a/src/index.less +++ b/src/index.less @@ -1,3 +1,5 @@ +@import '~antd/lib/style/v2-compatible-reset.less'; + html, body, :global(#root) { height: 100%; } diff --git a/src/routes/List/BasicList.js b/src/routes/List/BasicList.js index b3e9a8d2..5dd0369c 100644 --- a/src/routes/List/BasicList.js +++ b/src/routes/List/BasicList.js @@ -119,25 +119,23 @@ export default class BasicList extends PureComponent { 添加 - { - list && list.map(item => ( - 编辑, ]} - > - } - title={{item.title}} - description={item.subDescription} - /> - - - )) - } - + dataSource={list} + renderItem={item => ( + 编辑, ]} + > + } + title={{item.title}} + description={item.subDescription} + /> + + + )} + /> diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 098ec9ee..9b7cda8b 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -55,34 +55,35 @@ export default class CardList extends PureComponent { >
- - - - { - list && list.map(item => ( - - - 操作一, 操作二]}> - } - title={item.title} - description={( -

- {item.description} -

- )} - /> -
- + dataSource={['', ...list]} + renderItem={item => (item ? ( + + + 操作一, 操作二]}> + } + title={item.title} + description={( +

+ {item.description} +

+ )} + /> +
+ +
+ ) : ( + + - )) - } -
+ ) + )} + />
); diff --git a/src/routes/List/CoverCardList.js b/src/routes/List/CoverCardList.js index eacdceb9..0fef6b31 100644 --- a/src/routes/List/CoverCardList.js +++ b/src/routes/List/CoverCardList.js @@ -73,40 +73,39 @@ export default class CoverCardList extends PureComponent { const cardList = list ? ( - { - list.map(item => ( - - } - > - -
- {moment(item.updatedAt).fromNow()} -
- - { - item.members.map((member, i) => ( - - )) - } - -
+ dataSource={list} + renderItem={item => ( + + } + > + +
+ {moment(item.updatedAt).fromNow()} +
+ + { + item.members.map((member, i) => ( + + )) + } +
- - - )) - } - +
+
+
+ )} + /> ) : null; const tabList = [ diff --git a/src/routes/List/FilterCardList.js b/src/routes/List/FilterCardList.js index 7486017e..0b93c1e6 100644 --- a/src/routes/List/FilterCardList.js +++ b/src/routes/List/FilterCardList.js @@ -195,36 +195,35 @@ export default class FilterCardList extends PureComponent { - { - list && list.map(item => ( - - , - , - , - , - ]} - > - } - title={item.title} + dataSource={list} + renderItem={item => ( + + , + , + , + , + ]} + > + } + title={item.title} + /> +
+ -
- -
- - - )) - } - +
+
+
+ )} + />
); diff --git a/src/routes/List/SearchList.js b/src/routes/List/SearchList.js index f01378cd..d0974e3a 100644 --- a/src/routes/List/SearchList.js +++ b/src/routes/List/SearchList.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { routerRedux } from 'dva/router'; -import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col } from 'antd'; +import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col, Button } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import StandardFormRow from '../../components/StandardFormRow'; @@ -90,7 +90,7 @@ export default class SearchList extends Component { render() { const { showLoadMore, loadingMore } = this.state; - const { form, list: { list } } = this.props; + const { form, list: { list, loading } } = this.props; const { getFieldDecorator } = form; const owners = [ @@ -161,6 +161,15 @@ export default class SearchList extends Component { }, }; + const loadMore = showLoadMore ? ( +
+ +
+ ) : null; + return ( 0) && showLoadMore} - onLoadMore={this.handleLoadMore} + loading={loading} + rowKey="id" itemLayout="vertical" - > - { - list && list.map(item => ( - , , ]} - extra={
} - > - {item.title}} - description={Ant Design设计语言蚂蚁金服} - /> - - - )) - } - + loadMore={loadMore} + dataSource={list} + renderItem={item => ( + , , ]} + extra={
} + > + {item.title}} + description={Ant Design设计语言蚂蚁金服} + /> + + + )} + />
-- GitLab