-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathExamplePage.js
More file actions
47 lines (45 loc) · 971 Bytes
/
ExamplePage.js
File metadata and controls
47 lines (45 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React, { Component } from "react";
import { connect } from "dva";
import { Table } from "antd";
const columns = [
{
title: "姓名",
dataIndex: "name",
key: "name"
},
{
title: "年龄",
dataIndex: "age",
key: "age"
},
{
title: "住址",
dataIndex: "city",
key: "city"
}
];
@connect((state) => {
// example
console.log(state, 'state');
return {example: state.example}
}, {
getProductData: payload => ({ type: "example/getProductData", payload })
})
class ExamplePage extends Component {
dataSearch = () => {
// 异步获取数据
this.props.getProductData();
};
render() {
console.log("porps", this.props); //sy-log
const { data } = this.props.example;
return (
<div>
<h3>ExamplePage</h3>
<button onClick={this.dataSearch}>search</button>
<Table columns={columns} dataSource={data} rowKey="id" />
</div>
);
}
}
export default ExamplePage;