Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
95e168f7
Commit
95e168f7
authored
Apr 17, 2018
by
杨奕
Committed by
GitHub
Apr 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pagination: add prev-click and next-click events (#10755)
parent
d7e9e617
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
4 deletions
+40
-4
examples/docs/en-US/pagination.md
examples/docs/en-US/pagination.md
+4
-2
examples/docs/es/pagination.md
examples/docs/es/pagination.md
+2
-0
examples/docs/zh-CN/pagination.md
examples/docs/zh-CN/pagination.md
+4
-2
packages/pagination/src/pagination.js
packages/pagination/src/pagination.js
+2
-0
src/locale/lang/ug-CN.js
src/locale/lang/ug-CN.js
+0
-0
test/unit/specs/pagination.spec.js
test/unit/specs/pagination.spec.js
+28
-0
No files found.
examples/docs/en-US/pagination.md
View file @
95e168f7
...
...
@@ -226,8 +226,10 @@ Add more modules based on your scenario.
### Events
| Event Name | Description | Parameters |
|---------|--------|---------|
| size-change | triggers when
`page-size`
changes | the new
`page-size`
|
| current-change | triggers when
`current-page`
changes | the new
`current-page`
|
| size-change | triggers when
`page-size`
changes | the new page size |
| current-change | triggers when
`current-page`
changes | the new current page |
| prev-click | triggers when the prev button is clicked and current page changes | the new current page |
| next-click | triggers when the next button is clicked and current page changes | the new current page |
### Slot
| Name | Description |
...
...
examples/docs/es/pagination.md
View file @
95e168f7
...
...
@@ -214,6 +214,8 @@ Agrega más modulos basados en su escenario.
| ----------------- | --------------------------------------- | ----------------------------- |
| size-change | se dispara cuando
`page-size`
cambia | nuevo valor de
`page-size`
|
| current-change | se dispara cuando
`current-page`
cambia | nuevo valor de
`current-page`
|
| prev-click | triggers when the prev button is clicked and current page changes | the new current page |
| next-click | triggers when the next button is clicked and current page changes | the new current page |
### Slot
| Nombre | Descripción |
...
...
examples/docs/zh-CN/pagination.md
View file @
95e168f7
...
...
@@ -226,8 +226,10 @@
### Events
| 事件名称 | 说明 | 回调参数 |
|---------|--------|---------|
| size-change | pageSize 改变时会触发 | 每页条数
`size`
|
| current-change | currentPage 改变时会触发 | 当前页
`currentPage`
|
| size-change | pageSize 改变时会触发 | 每页条数 |
| current-change | currentPage 改变时会触发 | 当前页 |
| prev-click | 用户点击上一页按钮改变当前页后触发 | 当前页 |
| next-click | 用户点击下一页按钮改变当前页后触发 | 当前页 |
### Slot
| name | 说明 |
...
...
packages/pagination/src/pagination.js
View file @
95e168f7
...
...
@@ -306,6 +306,7 @@ export default {
if
(
this
.
disabled
)
return
;
const
newVal
=
this
.
internalCurrentPage
-
1
;
this
.
internalCurrentPage
=
this
.
getValidCurrentPage
(
newVal
);
this
.
$emit
(
'
prev-click
'
,
this
.
internalCurrentPage
);
this
.
emitChange
();
},
...
...
@@ -313,6 +314,7 @@ export default {
if
(
this
.
disabled
)
return
;
const
newVal
=
this
.
internalCurrentPage
+
1
;
this
.
internalCurrentPage
=
this
.
getValidCurrentPage
(
newVal
);
this
.
$emit
(
'
next-click
'
,
this
.
internalCurrentPage
);
this
.
emitChange
();
},
...
...
src/locale/lang/ug-CN
→
src/locale/lang/ug-CN
.js
View file @
95e168f7
File moved
test/unit/specs/pagination.spec.js
View file @
95e168f7
...
...
@@ -322,6 +322,34 @@ describe('Pagination', () => {
},
50
);
});
it
(
'
event: prev and next click
'
,
done
=>
{
vm
=
createVue
({
template
:
`
<el-pagination
:total="100"
layout="sizes, prev, pager, next"
@prev-click="trigger = true"
@next-click="trigger = true"
:pageSize="10" />
`
,
data
()
{
return
{
trigger
:
false
};
}
},
true
);
const
prev
=
vm
.
$el
.
querySelector
(
'
.btn-prev
'
);
const
next
=
vm
.
$el
.
querySelector
(
'
.btn-next
'
);
prev
.
click
();
setTimeout
(
_
=>
{
expect
(
vm
.
trigger
).
to
.
false
;
next
.
click
();
setTimeout
(
_
=>
{
expect
(
vm
.
trigger
).
to
.
true
;
done
();
},
50
);
},
50
);
});
it
(
'
pageSize > total
'
,
()
=>
{
vm
=
createVue
({
template
:
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment