Skip to content

Commit 8f87733

Browse files
committed
增加demo图片
1 parent bcbd924 commit 8f87733

File tree

4 files changed

+102
-86
lines changed

4 files changed

+102
-86
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# vue-pagination
2-
vue(1.0.3) 分页组件
2+
简单的分页组件
3+
```
4+
git clone https://github.com/cycgit/vue-pagination.git
5+
open index.html
6+
```
7+
![image](https://github.com/cycgit/vue-pagination/blob/master/demo.png)

demo.png

12.2 KB
Loading

index.css

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11

2-
ul,li{
3-
margin: 0px;
4-
padding: 0px;
2+
ul,li {
3+
margin: 0px;
4+
padding: 0px;
55
}
6-
.page-bar li{
7-
list-style: none;
8-
display: inline-block;
6+
7+
.page-bar li {
8+
list-style: none;
9+
display: inline-block;
910
}
11+
1012
.page-bar li:first-child>a {
11-
margin-left: 0px
13+
margin-left: 0px
1214
}
13-
.page-bar a{
14-
border: 1px solid #ddd;
15-
text-decoration: none;
16-
position: relative;
17-
float: left;
18-
padding: 6px 12px;
19-
margin-left: -1px;
20-
line-height: 1.42857143;
21-
color: #337ab7;
22-
cursor: pointer
15+
16+
.page-bar a {
17+
border: 1px solid #ddd;
18+
text-decoration: none;
19+
position: relative;
20+
float: left;
21+
padding: 6px 12px;
22+
margin-left: -1px;
23+
line-height: 1.42857143;
24+
color: #337ab7;
25+
cursor: pointer
2326
}
24-
.page-bar a:hover{
25-
background-color: #eee;
27+
28+
.page-bar a:hover {
29+
background-color: #eee;
2630
}
27-
.page-bar .active a{
28-
color: #fff;
29-
cursor: default;
30-
background-color: #337ab7;
31-
border-color: #337ab7;
31+
32+
.page-bar .active a {
33+
color: #fff;
34+
cursor: default;
35+
background-color: #337ab7;
36+
border-color: #337ab7;
3237
}
33-
.page-bar i{
34-
font-style:normal;
35-
color: #d44950;
36-
margin: 0px 4px;
37-
font-size: 12px;
38+
39+
.page-bar i {
40+
font-style:normal;
41+
color: #d44950;
42+
margin: 0px 4px;
43+
font-size: 12px;
3844
}
3945

4046

vue-nav.vue

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,83 +14,88 @@
1414
<script>
1515
export default {
1616
props: ['cur', 'all'],
17-
data(){
17+
data() {
1818
return {}
1919
},
2020
computed: {
21-
indexs: function(){
22-
var left = 1
23-
var right = this.all
24-
var ar = []
25-
if(this.all>= 11){
26-
if(this.cur > 5 && this.cur < this.all-4){
27-
left = this.cur - 5
28-
right = this.cur + 4
29-
}else{
30-
if(this.cur<=5){
31-
left = 1
32-
right = 10
33-
}else{
34-
right = this.all
35-
left = this.all -9
36-
}
21+
indexs: function() {
22+
var left = 1
23+
var right = this.all
24+
var ar = []
25+
if (this.all >= 11) {
26+
if (this.cur > 5 && this.cur < this.all - 4) {
27+
left = this.cur - 5
28+
right = this.cur + 4
29+
} else {
30+
if (this.cur <= 5) {
31+
left = 1
32+
right = 10
33+
} else {
34+
right = this.all
35+
left = this.all -9
3736
}
38-
}
39-
while (left <= right){
40-
ar.push(left)
41-
left ++
37+
}
4238
}
39+
while (left <= right) {
40+
ar.push(left)
41+
left ++
42+
}
4343
return ar
44-
}
44+
}
4545
},
4646
methods: {
47-
btnClick(data){
48-
if(data != this.cur){
49-
this.cur = data
50-
this.$dispatch('btn-click',data)
51-
52-
}
47+
btnClick(data) {
48+
if (data != this.cur) {
49+
this.cur = data
50+
this.$dispatch('btn-click',data)
5351
}
52+
}
5453
}
5554
}
5655
</script>
5756

5857
<style lang="css">
59-
ul,li{
60-
margin: 0px;
61-
padding: 0px;
58+
ul,li {
59+
margin: 0px;
60+
padding: 0px;
6261
}
63-
.page-bar li{
64-
list-style: none;
65-
display: inline-block;
62+
63+
.page-bar li {
64+
list-style: none;
65+
display: inline-block;
6666
}
67+
6768
.page-bar li:first-child>a {
68-
margin-left: 0px
69+
margin-left: 0px
6970
}
70-
.page-bar a{
71-
border: 1px solid #ddd;
72-
text-decoration: none;
73-
position: relative;
74-
float: left;
75-
padding: 6px 12px;
76-
margin-left: -1px;
77-
line-height: 1.42857143;
78-
color: #337ab7;
79-
cursor: pointer
71+
72+
.page-bar a {
73+
border: 1px solid #ddd;
74+
text-decoration: none;
75+
position: relative;
76+
float: left;
77+
padding: 6px 12px;
78+
margin-left: -1px;
79+
line-height: 1.42857143;
80+
color: #337ab7;
81+
cursor: pointer
8082
}
81-
.page-bar a:hover{
83+
84+
.page-bar a:hover {
8285
background-color: #eee;
8386
}
84-
.page-bar .active a{
85-
color: #fff;
86-
cursor: default;
87-
background-color: #337ab7;
88-
border-color: #337ab7;
87+
88+
.page-bar .active a {
89+
color: #fff;
90+
cursor: default;
91+
background-color: #337ab7;
92+
border-color: #337ab7;
8993
}
90-
.page-bar i{
91-
font-style:normal;
92-
color: #d44950;
93-
margin: 0px 4px;
94-
font-size: 12px;
94+
95+
.page-bar i {
96+
font-style:normal;
97+
color: #d44950;
98+
margin: 0px 4px;
99+
font-size: 12px;
95100
}
96101
</style>

0 commit comments

Comments
 (0)