File tree Expand file tree Collapse file tree 4 files changed +102
-86
lines changed Expand file tree Collapse file tree 4 files changed +102
-86
lines changed Original file line number Diff line number Diff line change 1
1
# 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 )
Original file line number Diff line number Diff line change 1
1
2
- ul , li {
3
- margin : 0px ;
4
- padding : 0px ;
2
+ ul , li {
3
+ margin : 0px ;
4
+ padding : 0px ;
5
5
}
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;
9
10
}
11
+
10
12
.page-bar li : first-child > a {
11
- margin-left : 0px
13
+ margin-left : 0px
12
14
}
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
23
26
}
24
- .page-bar a : hover {
25
- background-color : # eee ;
27
+
28
+ .page-bar a : hover {
29
+ background-color : # eee ;
26
30
}
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 ;
32
37
}
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 ;
38
44
}
39
45
40
46
Original file line number Diff line number Diff line change 14
14
<script >
15
15
export default {
16
16
props: [' cur' , ' all' ],
17
- data (){
17
+ data () {
18
18
return {}
19
19
},
20
20
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
37
36
}
38
- }
39
- while (left <= right){
40
- ar .push (left)
41
- left ++
37
+ }
42
38
}
39
+ while (left <= right) {
40
+ ar .push (left)
41
+ left ++
42
+ }
43
43
return ar
44
- }
44
+ }
45
45
},
46
46
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)
53
51
}
52
+ }
54
53
}
55
54
}
56
55
</script >
57
56
58
57
<style lang="css">
59
- ul ,li {
60
- margin : 0px ;
61
- padding : 0px ;
58
+ ul ,li {
59
+ margin : 0px ;
60
+ padding : 0px ;
62
61
}
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 ;
66
66
}
67
+
67
68
.page-bar li :first-child > a {
68
- margin-left : 0px
69
+ margin-left : 0px
69
70
}
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
80
82
}
81
- .page-bar a :hover {
83
+
84
+ .page-bar a :hover {
82
85
background-color : #eee ;
83
86
}
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 ;
89
93
}
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 ;
95
100
}
96
101
</style >
You can’t perform that action at this time.
0 commit comments