Skip to content

Instantly share code, notes, and snippets.

@que01
Last active July 6, 2016 02:05
Show Gist options
  • Save que01/2048b15527b02b10efb5fa316f2d3764 to your computer and use it in GitHub Desktop.
Save que01/2048b15527b02b10efb5fa316f2d3764 to your computer and use it in GitHub Desktop.
PaginationContainer.js
/**
* 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