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
3470bdfe
Commit
3470bdfe
authored
Oct 26, 2016
by
furybean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pagination: rename currentchange & sizechange.
parent
63433f28
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
35 deletions
+50
-35
CHANGELOG.md
CHANGELOG.md
+1
-0
examples/docs/zh-cn/pagination.md
examples/docs/zh-cn/pagination.md
+11
-11
packages/pagination/src/pager.vue
packages/pagination/src/pager.vue
+1
-1
packages/pagination/src/pagination.js
packages/pagination/src/pagination.js
+21
-8
packages/table/src/table.vue
packages/table/src/table.vue
+9
-9
src/mixins/migrating.js
src/mixins/migrating.js
+1
-0
test/unit/specs/pagination.spec.js
test/unit/specs/pagination.spec.js
+6
-6
No files found.
CHANGELOG.md
View file @
3470bdfe
...
...
@@ -28,6 +28,7 @@
-
全屏 Loading 现在默认不再锁定屏幕滚动。如果需要的话,可添加
`lock`
修饰符
-
Table 删除属性 fixedColumnCount, customCriteria, customBackgroundColors
-
Table 的 selectionchange、cellmouseenter、cellmouseleave、cellclick 事件更名为 selection-change、cell-mouse-enter、cell-mouse-leave、cell-click。
-
Pagination 的 currentchange、sizechange 事件更名为 current-change、size-change
### 1.0.0-rc.7
...
...
examples/docs/zh-cn/pagination.md
View file @
3470bdfe
...
...
@@ -42,15 +42,15 @@
根据场景需要,可以添加其他功能模块。
:::demo 此例是一个完整的用例,使用了
`size
change`
和
`current
change`
事件来处理页码大小和当前页变动时候触发的事件。
`page-sizes`
接受一个整型数组,数组元素为展示的选择每页显示个数的选项,
`[100, 200, 300, 400]`
表示四个选项,每页显示 100 个,200 个,300 个或者 400 个。
:::demo 此例是一个完整的用例,使用了
`size
-change`
和
`current-
change`
事件来处理页码大小和当前页变动时候触发的事件。
`page-sizes`
接受一个整型数组,数组元素为展示的选择每页显示个数的选项,
`[100, 200, 300, 400]`
表示四个选项,每页显示 100 个,200 个,300 个或者 400 个。
```
html
<template>
<div
class=
"block"
>
<span
class=
"demonstration"
>
显示总数
</span>
<el-pagination
@
sizechange=
"handleSizeChange"
@
currentchange=
"handleCurrentChange"
@
size
-
change=
"handleSizeChange"
@
current
-
change=
"handleCurrentChange"
:current-page=
"5"
:page-size=
"100"
layout=
"total, prev, pager, next"
...
...
@@ -60,8 +60,8 @@
<div
class=
"block"
>
<span
class=
"demonstration"
>
调整每页显示条数
</span>
<el-pagination
@
sizechange=
"handleSizeChange"
@
currentchange=
"handleCurrentChange"
@
size
-
change=
"handleSizeChange"
@
current
-
change=
"handleCurrentChange"
:current-page=
"5"
:page-sizes=
"[100, 200, 300, 400]"
:page-size=
"100"
...
...
@@ -72,8 +72,8 @@
<div
class=
"block"
>
<span
class=
"demonstration"
>
直接前往
</span>
<el-pagination
@
sizechange=
"handleSizeChange"
@
currentchange=
"handleCurrentChange"
@
size
-
change=
"handleSizeChange"
@
current
-
change=
"handleCurrentChange"
:current-page=
"5"
:page-size=
"100"
layout=
"prev, pager, next, jumper"
...
...
@@ -83,8 +83,8 @@
<div
class=
"block"
>
<span
class=
"demonstration"
>
完整功能
</span>
<el-pagination
@
sizechange=
"handleSizeChange"
@
currentchange=
"handleCurrentChange"
@
size
-
change=
"handleSizeChange"
@
current
-
change=
"handleCurrentChange"
:current-page=
"5"
:page-sizes=
"[100, 200, 300, 400]"
:page-size=
"100"
...
...
@@ -191,5 +191,5 @@
### Events
| 事件名称 | 说明 | 回调参数 |
|---------|--------|---------|
| sizechange | pageSize 改变时会触发 | 每页条数
`size`
|
| currentchange | currentPage 改变时会触发 | 当前页
`currentPage`
|
| size
-
change | pageSize 改变时会触发 | 每页条数
`size`
|
| current
-
change | currentPage 改变时会触发 | 当前页
`currentPage`
|
packages/pagination/src/pager.vue
View file @
3470bdfe
...
...
@@ -80,7 +80,7 @@
}
if
(
newPage
!==
currentPage
)
{
this
.
$emit
(
'
c
urrentc
hange
'
,
newPage
);
this
.
$emit
(
'
change
'
,
newPage
);
}
}
},
...
...
packages/pagination/src/pagination.js
View file @
3470bdfe
...
...
@@ -2,10 +2,13 @@ import Vue from 'vue';
import
Pager
from
'
./pager.vue
'
;
import
ElSelect
from
'
element-ui/packages/select
'
;
import
ElOption
from
'
element-ui/packages/option
'
;
import
Migrating
from
'
element-ui/src/mixins/migrating
'
;
export
default
{
name
:
'
ElPagination
'
,
mixins
:
[
Migrating
],
props
:
{
pageSize
:
{
type
:
Number
,
...
...
@@ -50,7 +53,7 @@ export default {
const
TEMPLATE_MAP
=
{
prev
:
<
prev
><
/prev>
,
jumper
:
<
jumper
><
/jumper>
,
pager
:
<
pager
currentPage
=
{
this
.
internalCurrentPage
}
pageCount
=
{
this
.
pageCount
}
on
-
c
urrentc
hange
=
{
this
.
handleCurrentChange
}
><
/pager>
,
pager
:
<
pager
currentPage
=
{
this
.
internalCurrentPage
}
pageCount
=
{
this
.
pageCount
}
on
-
change
=
{
this
.
handleCurrentChange
}
><
/pager>
,
next
:
<
next
><
/next>
,
sizes
:
<
sizes
><
/sizes>
,
slot
:
<
slot
><
/slot>
,
...
...
@@ -153,7 +156,7 @@ export default {
handleChange
(
val
)
{
if
(
val
!==
this
.
$parent
.
internalPageSize
)
{
this
.
$parent
.
internalPageSize
=
val
=
parseInt
(
val
,
10
);
this
.
$parent
.
$emit
(
'
sizechange
'
,
val
);
this
.
$parent
.
$emit
(
'
size
-
change
'
,
val
);
}
}
}
...
...
@@ -173,7 +176,7 @@ export default {
handleChange
({
target
})
{
this
.
$parent
.
internalCurrentPage
=
this
.
$parent
.
getValidCurrentPage
(
target
.
value
);
this
.
$parent
.
$emit
(
'
currentchange
'
,
this
.
$parent
.
internalCurrentPage
);
this
.
$parent
.
$emit
(
'
current
-
change
'
,
this
.
$parent
.
internalCurrentPage
);
this
.
oldValue
=
null
;
}
},
...
...
@@ -210,9 +213,19 @@ export default {
},
methods
:
{
getMigratingConfig
()
{
return
{
props
:
{},
events
:
{
'
currentchange
'
:
'
Pagination: currentchange has been renamed to current-change
'
,
'
sizechange
'
:
'
Pagination: sizechange has been renamed to size-change
'
}
};
},
handleCurrentChange
(
val
)
{
this
.
internalCurrentPage
=
this
.
getValidCurrentPage
(
val
);
this
.
$emit
(
'
currentchange
'
,
this
.
internalCurrentPage
);
this
.
$emit
(
'
current
-
change
'
,
this
.
internalCurrentPage
);
},
prev
()
{
...
...
@@ -221,7 +234,7 @@ export default {
this
.
internalCurrentPage
=
this
.
getValidCurrentPage
(
newVal
);
if
(
this
.
internalCurrentPage
!==
oldPage
)
{
this
.
$emit
(
'
currentchange
'
,
this
.
internalCurrentPage
);
this
.
$emit
(
'
current
-
change
'
,
this
.
internalCurrentPage
);
}
},
...
...
@@ -231,7 +244,7 @@ export default {
this
.
internalCurrentPage
=
this
.
getValidCurrentPage
(
newVal
);
if
(
this
.
internalCurrentPage
!==
oldPage
)
{
this
.
$emit
(
'
currentchange
'
,
this
.
internalCurrentPage
);
this
.
$emit
(
'
current
-
change
'
,
this
.
internalCurrentPage
);
}
},
...
...
@@ -242,7 +255,7 @@ export default {
// this.internalCurrentPage = this.getValidCurrentPage(newVal);
// if (this.internalCurrentPage !== oldPage) {
// this.$emit('currentchange', this.internalCurrentPage);
// this.$emit('current
-
change', this.internalCurrentPage);
// }
// },
...
...
@@ -252,7 +265,7 @@ export default {
// this.internalCurrentPage = this.getValidCurrentPage(newVal);
// if (this.internalCurrentPage !== oldPage) {
// this.$emit('currentchange', this.internalCurrentPage);
// this.$emit('current
-
change', this.internalCurrentPage);
// }
// },
...
...
packages/table/src/table.vue
View file @
3470bdfe
...
...
@@ -143,17 +143,17 @@
getMigratingConfig
()
{
return
{
props
:
{
'
allow-no-selection
'
:
'
allow-no-selection is
removed.
'
,
'
selection-mode
'
:
'
selection-mode is
removed.
'
,
'
fixed-column-count
'
:
'
fixed-column-count is
removed. Use fixed prop in TableColumn instead.
'
,
'
custom-criteria
'
:
'
custom-criteria is
removed. Use row-class-name instead.
'
,
'
custom-background-colors
'
:
'
custom-background-colors
is
removed. Use row-class-name instead.
'
'
allow-no-selection
'
:
'
Table: allow-no-selection has been
removed.
'
,
'
selection-mode
'
:
'
Table: selection-mode has been
removed.
'
,
'
fixed-column-count
'
:
'
Table: fixed-column-count has been
removed. Use fixed prop in TableColumn instead.
'
,
'
custom-criteria
'
:
'
Table: custom-criteria has been
removed. Use row-class-name instead.
'
,
'
custom-background-colors
'
:
'
custom-background-colors
has been
removed. Use row-class-name instead.
'
},
events
:
{
selectionchange
:
'
selectionchange is
renamed to selection-change.
'
,
cellmouseenter
:
'
cellmouseenter is
renamed to cell-mouse-enter.
'
,
cellmouseleave
:
'
cellmouseleave is
renamed to cell-mouse-leave.
'
,
cellclick
:
'
cellclick is
renamed to cell-click.
'
selectionchange
:
'
Table: selectionchange has been
renamed to selection-change.
'
,
cellmouseenter
:
'
Table: cellmouseenter has been
renamed to cell-mouse-enter.
'
,
cellmouseleave
:
'
Table: cellmouseleave has been
renamed to cell-mouse-leave.
'
,
cellclick
:
'
Table: cellclick has been
renamed to cell-click.
'
}
};
},
...
...
src/mixins/migrating.js
View file @
3470bdfe
...
...
@@ -22,6 +22,7 @@
export
default
{
mounted
()
{
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
return
;
if
(
!
this
.
$vnode
)
return
;
const
{
props
,
events
}
=
this
.
getMigratingConfig
();
const
{
data
,
componentOptions
}
=
this
.
$vnode
;
const
definedProps
=
data
.
attrs
||
{};
...
...
test/unit/specs/pagination.spec.js
View file @
3470bdfe
...
...
@@ -101,7 +101,7 @@ describe('Pagination', () => {
const
vm
=
createVue
({
template
:
`
<el-pagination
@currentchange="handleChange"
@current
-
change="handleChange"
:page-size="10"
:total="100" />
`
,
...
...
@@ -132,12 +132,12 @@ describe('Pagination', () => {
expect
(
vm
.
page
).
to
.
equal
(
1
);
});
it
(
'
event:currentchange
'
,
()
=>
{
it
(
'
event:current
-
change
'
,
()
=>
{
const
vm
=
createVue
({
template
:
`
<el-pagination
:total="1000"
@currentchange="change = true" />
@current
-
change="change = true" />
`
,
data
()
{
...
...
@@ -158,13 +158,13 @@ describe('Pagination', () => {
expect
(
vm
.
change
).
to
.
true
;
});
it
(
'
event:sizechange
'
,
done
=>
{
it
(
'
event:size
-
change
'
,
done
=>
{
const
vm
=
createVue
({
template
:
`
<el-pagination
:total="100"
layout="sizes, prev, pager, next"
@sizechange="trigger = true"
@size
-
change="trigger = true"
:pageSize="10" />
`
,
...
...
@@ -185,7 +185,7 @@ describe('Pagination', () => {
const
vm
=
createVue
({
template
:
`
<el-pagination
@currentchange="handleChange"
@current
-
change="handleChange"
:page-size="1000"
:total="0" />
`
,
...
...
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