Merge pull request #64 from eleme/feat/fix-eventname

update pagination and select event name
This commit is contained in:
FuryBean 2016-08-15 15:24:11 +08:00 committed by GitHub
commit aba8b84722
4 changed files with 28 additions and 14 deletions

View File

@ -50,8 +50,8 @@
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@sizechange="handleSizeChange"
@currentchange="handleCurrentChange"
layout="sizes, prev, pager, next, jumper, total"
:total="1000">
</el-pagination>
@ -85,6 +85,10 @@
| current-page | 当前页数 | Number | | 0|
| layout | 组件布局,子组件名用逗号分隔。| String | `prev`, `pager`, `next`, `jumper`, `slot`, `->`, `total` | 'prev, pager, next, jumper, slot, ->, total' |
| page-sizes | 切换每页显示个数的子组件值 | Number[] | | [10, 20, 30, 40, 50, 100] |
| size-change | pageSize 改变时会触发的事件 | Function | | |
| current-change | currentPage 改变时会触发的事件 | Function | | |
## 事件
| 事件名称 | 说明 | 回调函数 |
|---------|--------|---------|
| sizechange | pageSize 改变时会触发 | `size` |
| currentchange | currentPage 改变时会触发 | `currentPage` |

View File

@ -755,7 +755,11 @@
| remote | 是否为远程搜索 | boolean | | false |
| remote-method | 远程搜索方法,当搜索关键字变化时会调用该方法,参数为目前的搜索关键字 | function | | |
| loading | 是否正在从远程获取数据 | boolean | | false |
| change | value 发生变化时的回调函数,参数为 value 的值 | function | | |
### el-select 事件
| 事件名称 | 说明 | 回调参数 |
|---------|---------|---------|
| change | value 发生变化| `value` |
### el-option-group
| 参数 | 说明 | 类型 | 可选值 | 默认值 |

View File

@ -71,7 +71,7 @@
}
if (newPage !== currentPage) {
this.$emit('currentChange', newPage);
this.$emit('currentchange', newPage);
}
}
},

View File

@ -49,7 +49,7 @@ export default {
const TEMPLATE_MAP = {
prev: <prev></prev>,
jumper: <jumper></jumper>,
pager: <pager currentPage={ this.internalCurrentPage } pageCount={ this.pageCount } on-currentChange={ this.handleCurrentChange }></pager>,
pager: <pager currentPage={ this.internalCurrentPage } pageCount={ this.pageCount } on-currentchange={ this.handleCurrentChange }></pager>,
next: <next></next>,
sizes: <sizes></sizes>,
slot: <slot></slot>,
@ -114,6 +114,12 @@ export default {
},
Sizes: {
created() {
if (Array.isArray(this.$parent.pageSizes)) {
this.$parent.internalPageSize = this.$parent.pageSizes[0];
}
},
render(h) {
return (
<span class="el-pagination__sizes">
@ -144,7 +150,7 @@ export default {
handleChange(val) {
if (val !== this.$parent.internalPageSize) {
this.$parent.internalPageSize = val = parseInt(val, 10);
this.$parent.$emit('size-change', val);
this.$parent.$emit('sizechange', val);
}
}
}
@ -167,7 +173,7 @@ export default {
this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
if (target.value !== this.oldValue && Number(target.value) === this.$parent.internalCurrentPage) {
this.$parent.$emit('current-change', this.$parent.internalCurrentPage);
this.$parent.$emit('currentchange', this.$parent.internalCurrentPage);
}
this.oldValue = null;
@ -209,7 +215,7 @@ export default {
methods: {
handleCurrentChange(val) {
this.internalCurrentPage = this.getValidCurrentPage(val);
this.$emit('current-change', this.internalCurrentPage);
this.$emit('currentchange', this.internalCurrentPage);
},
prev() {
@ -218,7 +224,7 @@ export default {
this.internalCurrentPage = this.getValidCurrentPage(newVal);
if (this.internalCurrentPage !== oldPage) {
this.$emit('current-change', this.internalCurrentPage);
this.$emit('currentchange', this.internalCurrentPage);
}
},
@ -228,7 +234,7 @@ export default {
this.internalCurrentPage = this.getValidCurrentPage(newVal);
if (this.internalCurrentPage !== oldPage) {
this.$emit('current-change', this.internalCurrentPage);
this.$emit('currentchange', this.internalCurrentPage);
}
},
@ -238,7 +244,7 @@ export default {
this.internalCurrentPage = this.getValidCurrentPage(newVal);
if (this.internalCurrentPage !== oldPage) {
this.$emit('current-change', this.internalCurrentPage);
this.$emit('currentchange', this.internalCurrentPage);
}
},
@ -248,7 +254,7 @@ export default {
this.internalCurrentPage = this.getValidCurrentPage(newVal);
if (this.internalCurrentPage !== oldPage) {
this.$emit('current-change', this.internalCurrentPage);
this.$emit('currentchange', this.internalCurrentPage);
}
},