-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangyue0503
committed
Jul 31, 2018
1 parent
ea87511
commit 2fdc8f9
Showing
5 changed files
with
818 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
doctype | ||
html(lang="en") | ||
head | ||
meta(charset="UTF-8") | ||
meta(name="viewport", content="width=device-width, initial-scale=1.0") | ||
meta(http-equiv="X-UA-Compatible", content="ie=edge") | ||
title Document | ||
style. | ||
ol li{float:left;margin:30px;list-style:none;} | ||
.active{color:red;} | ||
body | ||
ul | ||
-for(var i=0;i < listArr.length;i++) | ||
li=listArr[i] | ||
ol | ||
-for(var i=0;i<maxl;i++) | ||
li | ||
if(i==index-1) | ||
a.active(href="http://localhost:8020/list?page="+(i+1))=i+1 | ||
else | ||
a(href="http://localhost:8020/list?page="+(i+1))=i+1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var express = require('express'); | ||
var jade = require('jade'); | ||
|
||
var listRouter = express.Router(); | ||
|
||
var server = express(); | ||
|
||
server.listen(8020); | ||
|
||
var arr = [ | ||
'aaaaaaaaa', | ||
'bbbbbbbbb', | ||
'ccccccccc', | ||
'ddddddddd', | ||
'eeeeeeeee', | ||
'fffffffff', | ||
'ggggggggg', | ||
'aaaaaaaaa-1', | ||
'bbbbbbbbb-1', | ||
'ccccccccc-1', | ||
'ddddddddd-1', | ||
'eeeeeeeee-1', | ||
'fffffffff-1', | ||
'ggggggggg-1', | ||
'aaaaaaaaa-2', | ||
'bbbbbbbbb-2', | ||
'ccccccccc-2', | ||
'ddddddddd-2', | ||
'eeeeeeeee-2', | ||
'fffffffff-2', | ||
'ggggggggg-2', | ||
]; | ||
|
||
server.use('/list',listRouter); | ||
|
||
listRouter.use('',function(req,res){ | ||
// console.log(1); | ||
var needArr = arr.slice((req.query.page-1)*4,req.query.page*4); | ||
var maxLi = Math.ceil(arr.length/4); | ||
var str = jade.renderFile('./1.jade',{pretty:true,listArr:needArr,maxl:maxLi,index:req.query.page}); | ||
|
||
res.send(str); | ||
}); |
Oops, something went wrong.