提供大部分的 antd 组件以及 dva 的代码片段,以下是一些例子.
<Button type="primary">按钮</Button>
<Row gutter={16}>
<Col span={6}></Col>
<Col span={6}></Col>
<Col span={6}></Col>
<Col span={6}></Col>
</Row>
const columns = [
{
title: '',
dataIndex: '',
},
];
function handleTableChange(pagination, filters, sorter) {}
<Table
rowKey="id"
dataSource={[]}
columns={columns}
loading={loading}
onChange={handleTableChange}
pagination={{
current: current,
pageSize: pageSize,
total: total,
showSizeChanger: true,
showQuickJumper: true,
showTotal: (total) => `共 ${total} 条`,
}}
/>
import { cloneDeep } from 'lodash-es';
const state = {};
export default {
namespace: 'name',
subscriptions: {
setup({ dispatch, history }) {
history.listen(({ pathname }) => {
if (pathname === '/pathname') {
dispatch({ type: 'reset' });
}
});
},
},
state: cloneDeep(state),
effects: {},
reducers: {
save(state, { payload }) {
return {
...state,
...payload,
};
},
reset() {
return cloneDeep(state);
},
},
};
Enjoy!