废话不多说,下面是分享react.js页面插件代码,下面所示的具体代码:


VaR
页= React.createClass({
渲染:函数()
{
中间代码更新
VaR
totalrows =
this.props.totalrows;
VaR
listrows =
this.props.listrows;
VaR
nowpage =
这个道具。nowpage > 0this。道具。nowpage:1;
VaR
重=
This.props.listRows* (this.props.nowPage-1);
VaR
totalpage =
Math.ceil(totalrows / listrows);
VaR
show_count =这个道具。show_countthis。道具。show_count:5;
如果(!(!totalpage)nowpage > totalpage)
{
这nowpage = totalpage。道具;
}
如果(这个道具。nowpage<1)
{
这个道具。nowpage = 1;
}
VaR
show_count_mid = show_count / 2;
VaR
页= };
为(VaR
我= 1;i < = show_count;i++)
{
VaR
页面= 0;
如果(nowpage <= show_count_mid)
{
页
=我;
}
如果(nowpage + show_count_mid > totalpage)
{
页
= totalpage
show_count +我;
}
其他的
{
页
= nowpage-math.ceil(show_count_mid)+我;
}
如果0page(页>!= nowpage)
{
如果(页< = totalpage)
{
Pages.push(<李
this.props.onpagination.bind onclick = {(这页)} > {页});
}
}
其他的
{
Pages.push(<李
名为主动> {页});
}
}
这pagesbutton =页;
返回
(
这个道具。totalrows > 0(
< UL
名为分页>
总:{这个道具。totalrows }
{这个道具。nowpage }或{ Math.ceil(这个道具。totalrows /这个道具。listrows)}
<李
this.props.onpagination.bind onclick = {(,1)} >第一页
<李
this.props.onpagination.bind onclick = {(这个,这个道具。nowpage = = 11:这个道具。nowpage-1)} > <
href =#没有>
{这pagesbutton }。
<李
this.props.onpagination.bind onclick = {(这个,这个道具。nowpage = =这个道具。totalpagethis。道具。totalpage:这个道具。nowpage + 1)} >
<
href =#无>

<李
this.props.onpagination.bind onclick = {(这个,Math.ceil(这个道具。totalrows /这个道具。listrows))} >尾页

(:)
< UL
名为分页>
没有数据

)
);
}
});


以上是网页插件react.js桨Xiaobi给出的示例代码,希望对大家有帮助。如果你有任何问题,请给我留言,萧边会及时给您回复。谢谢您支持网站。