Comparing version 1.0.0 to 1.0.1
/*! | ||
@Name : layPage v1.2 - Node.js 分页模块 | ||
@Name : layPage v1.x - Node.js 分页模块 | ||
@Author: 贤心 | ||
@Site:http://www.layui.com/laypage | ||
@Site:http://www.layui.com/ | ||
@License:MIT | ||
@@ -17,6 +17,6 @@ | ||
that.query = /\/page\/\d+?(\/*)$/; | ||
var conf = that.config = options || {}; | ||
that.config = options || {}; | ||
}; | ||
laypage.v = '1.2'; | ||
laypage.v = '1.x'; | ||
@@ -23,0 +23,0 @@ //分页视图 |
@@ -1,4 +0,4 @@ | ||
{ | ||
{ | ||
"name": "laypage", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Node.js 分页模块", | ||
@@ -13,4 +13,11 @@ "main": "index.js", | ||
], | ||
"author": "贤心", | ||
"license": "MIT" | ||
"author": { | ||
"name": "贤心" | ||
}, | ||
"license": "MIT", | ||
"readme": "\n## 介绍(Introduce)\n文档还在整理中\n\n## 协议(License) \nThe MIT License\n\n\n", | ||
"readmeFilename": "README.md", | ||
"_id": "laypage@1.0.0", | ||
"_shasum": "ffdc2cd04a3f32b3d6ebf10d4ede893da4e6389c", | ||
"_from": "laypage@*" | ||
} |
## 介绍(Introduce) | ||
文档还在整理中 | ||
layPage是一款非常灵活的分页(paging)模块,其使用较为简单,但是却需要遵循一定的路由规则,比如:/page/:num,也就是说,它并不支持参数的分页形式,而是采用目录的分页结构。 | ||
它提供了数量合适的可选参数,可方便于您对分页样式和风格的定义。官网(http://www.layui.com) | ||
## 安装(Installation) | ||
$ npm install laypage | ||
## 使用(Usage) | ||
因为layPage的使用方式需依赖于页面的request,因此下述采用Express为例。 | ||
### 第一步:设定分页路由 | ||
var router = require('express').Router(); | ||
var laypage = require('laypage'); | ||
//请注意,list部分你可以任意定义,但是后面必须严格遵循 /page/:num 的格式 | ||
router.get('list/page/:num', function(req, res){ | ||
//第二步 | ||
}); | ||
### 第二步:作为渲染的参数 | ||
router.get('list/page/:num', function(req, res){ | ||
res.render('模版文件地址', { | ||
laypage: laypage({ | ||
curr: req.params.page || 1 | ||
,url: req.url //必传参数,获取当前页的url | ||
,pages: 18 //分页总数你需要通过sql查询得到 | ||
}) | ||
}) | ||
}); | ||
### 第三步:在模版中输出分页 | ||
<html> | ||
<body> | ||
<%= laypage %> <!-- ejs --> | ||
{{ d.laypage }} <!-- laytpl --> | ||
</body> | ||
</html> | ||
仅需三步,您就轻松地完成了一个分页的输出,但是laypage并不提供样式,它只动态输出分页的基本结构。下面是我们给的样式例子: | ||
/* laypage分页 */ | ||
.laypage-main, | ||
.laypage-main *{display:inline-block; *display:inline; *zoom:1; vertical-align:top;} | ||
.laypage-main{margin:20px 0; border: 1px solid #009E94; border-right: none; border-bottom: none; font-size: 0;} | ||
.laypage-main *{padding: 0 15px; line-height:28px; border-right: 1px solid #009E94; border-bottom: 1px solid #009E94; font-size:14px;} | ||
.laypage-main .laypage-curr{background-color:#009E94; color:#fff;} | ||
## 文档(document) | ||
好了,是时候介绍基础文档了,laypage的调用提供了以下参数(options)的选择 | ||
laypage({ | ||
curr: 1 //当前页,通过req.params.page即可得到(必选) | ||
,pages: 18 //分页总数,可通过sql查询得到(必选) | ||
,url: req.url //当前页的url(必选) | ||
,groups: 3 //连续显示的分页数,默认3 (可选) | ||
,first: 1 //首页显示的文本,默认1(可选) | ||
,last: pages //尾页显示的文本,默认是最大页数(可选) | ||
,prev: '上一页' //上一页自定义文本(可选) | ||
,next: '下一页' //下一页自定义文本(可选) | ||
,skip: false, //是否输出跳页框,默认false(可选) | ||
,className: 'laypage' //分页样式的前缀,默认为laypage(可选) | ||
}) | ||
## 协议(License) | ||
The MIT License | ||
## 备注(remark) | ||
官网:(http://www.layui.com) | ||
浏览器版(http://sentsin.com/layui/laypage/) | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Invalid manifest file
QualityPackage has an invalid manifest file and can cause installation problems if you try to use it.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7810
1
0
74
0
1
2