Commit 8880d270 by rtclub11140

add emitt

1 parent d87f7bf1
Showing with 11 additions and 4 deletions
import React, { Component, Fragment } from 'react' import React, { Component, Fragment } from 'react'
import { Table, Modal, Button } from 'antd' import { Table, Modal, Button } from 'antd'
import guidepost from './resources/images/guidepost.png' import guidepost from './resources/images/guidepost.png'
import data from './resources/json/dataList.json' //import data from './resources/json/dataList.json'
import * as EventConstants from '../../../resources/js/constants/EventConstants'
class WDSTransLog extends Component { class WDSTransLog extends Component {
state = { visible: false, message: '' } state = { visible: false, message: '', dataList: '' }
_handleShowModal = data => { _handleShowModal = data => {
this.setState({ this.setState({
...@@ -31,6 +32,12 @@ class WDSTransLog extends Component { ...@@ -31,6 +32,12 @@ class WDSTransLog extends Component {
return `Total ${total} items` return `Total ${total} items`
} }
componentDidMount() {
this.props.eventEmitter.on(EventConstants.RESULT_LOG, data => {
this.setState({ dataList: data })
})
}
render() { render() {
const colums = [ const colums = [
{ {
...@@ -113,12 +120,12 @@ class WDSTransLog extends Component { ...@@ -113,12 +120,12 @@ class WDSTransLog extends Component {
return ( return (
<Fragment> <Fragment>
<Table <Table
dataSource={data} dataSource={this.state.dataList}
columns={colums} columns={colums}
pagination={{ pagination={{
pageSize: 5, pageSize: 5,
showTotal: this._showTotal, showTotal: this._showTotal,
total: data.length, total: this.state.dataList.length,
size: 'small', size: 'small',
}} }}
/> />
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!