import React, { useEffect } from 'react';
import { connect } from 'dva';
import { Form } from 'antd';
import { formatMessage } from 'umi/locale';
import Panel from '@/components/Panel';
import Grid from '@/components/Sword/Grid';
const WaterListInner = props => {
const { form, water } = props;
useEffect(() => {
console.log(water);
}, []);
const renderSearchForm = () => {
return <div>123</div>;
};
const columns = [
{
title: formatMessage({ id: 'desk.notice.title' }),
dataIndex: 'title',
},
{
title: formatMessage({ id: 'desk.notice.category' }),
dataIndex: 'categoryName',
},
];
return (
<Panel>
<Grid
form={form}
code="water-list"
data={water.data}
columns={columns}
renderSearchForm={renderSearchForm}
/>
</Panel>
);
};
export default connect(({ water }) => ({ water }))(Form.create()(WaterListInner));
models就简单了
export default {
namespace: 'water',
state: {
data: {
list: [{ title: '123' }, { title: '456' }],
pagination: {},
},
},
};