Last active
July 6, 2016 02:05
-
-
Save que01/2048b15527b02b10efb5fa316f2d3764 to your computer and use it in GitHub Desktop.
PaginationContainer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by que01 on 16/6/14. | |
*/ | |
import React, { PropTypes } from 'react'; | |
// ant文件 | |
import { Pagination} from 'antd'; | |
import s from './Home.css'; | |
import {connect} from 'react-redux'; | |
import {setRuntimeVariable} from '../../actions/runtime'; | |
let PaginationContainer = React.createClass({ | |
onChange(page) { | |
this.props.setRuntime({ | |
name:"currentPage", | |
value:page | |
}); | |
}, | |
onShowSizeChange(currentPage,pageSize){ | |
this.props.setRuntime({ | |
name:"pageSize", | |
value:pageSize | |
}) | |
}, | |
render() { | |
return ( | |
<div className={s.container}> | |
<Pagination current={this.props.currentPage} | |
onChange={this.onChange} | |
onShowSizeChange={this.onShowSizeChange} | |
total={this.props.newsTotalItem} | |
showSizeChanger showQuickJumper | |
/>; | |
</div> | |
) | |
}, | |
}); | |
export default connect(state => ({ | |
currentPage: state.runtime.currentPage, | |
newsTotalItem:state.runtime.newsTotalItem, | |
}), {setRuntime:setRuntimeVariable})(PaginationContainer); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment