zpage
v0.0.7
Published
Node.js 分页模块
Downloads
3
Readme
Node.js 分页模块
使用(Usage)
Express使用列子
路由
app.get(['/page', '/page/:page'], function(req, res, next) {
var params = req.params;
var page = params.page;
res.render('page', {
zpage: zpage({
page: page, // 当前页数(必填,默认为1)
count: 100, // 总分页数(必填)
type: 'GET', // 默认 GET(可选)
indexUrl: '', // 首页URL(可选)
url: '/page/', // type = 'GET' (必填) POST(可选)
groups: 5, // 连续显示的分页数,默认5(可选)
first: '首页', // 首页显示的文本 默认为首页,填0可隐藏(可选)
last: '尾页', // 尾页显示的文本,默认为首页,填0可隐藏(可选)
prev: '上一页', // 上一页自定义文本(可选)
next: '下一页', // 下一页自定义文本(可选),
className:'zpage',// 分页样式的前缀,默认为zpage(可选)
})
})
})
Jade中调用
!{zpage}
SCSS
.z-page {
* {
display: inline-block;
box-sizing: border-box;
min-width: 31px;
margin: 0 0 6px 6px;
margin-left: 10px;
padding: 0px 10px;
cursor: pointer;
text-align: center;
text-decoration: none;
border: 1px solid #ccc;
height: 28px;
line-height: 28px;
&:hover,
&.active {
background-color: #61b3e6;
border-color: #61b3e6;
color: #fff;
}
}
}