From 2ff8ba05a4264283c995c1277e9f9d4e80116e9b Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Tue, 14 Jul 2020 23:09:32 +0800
Subject: [PATCH] feat: update pagination
---
components/pagination/Pagination.jsx | 4 ++--
components/pagination/index.js | 2 --
components/vc-pagination/Pagination.jsx | 24 +++++++++++-------------
examples/App.vue | 2 +-
examples/index.js | 2 ++
5 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/components/pagination/Pagination.jsx b/components/pagination/Pagination.jsx
index 58dd57a62..d8d7326a1 100644
--- a/components/pagination/Pagination.jsx
+++ b/components/pagination/Pagination.jsx
@@ -113,7 +113,7 @@ export default {
...this.getIconsProps(prefixCls),
selectComponentClass: isSmall ? MiniSelect : VcSelect,
locale: { ...contextLocale, ...customLocale },
- buildOptionText: buildOptionText || this.$slots.buildOptionText?.(),
+ buildOptionText: buildOptionText || this.$slots.buildOptionText,
...this.$attrs,
class: classNames({ mini: isSmall }, this.$attrs.class),
};
@@ -126,7 +126,7 @@ export default {
);
},
diff --git a/components/pagination/index.js b/components/pagination/index.js
index 181bd30c5..2c0a580a1 100644
--- a/components/pagination/index.js
+++ b/components/pagination/index.js
@@ -1,11 +1,9 @@
import Pagination from './Pagination';
-import Base from '../base';
export { PaginationProps, PaginationConfig } from './Pagination';
/* istanbul ignore next */
Pagination.install = function(app) {
- app.use(Base);
app.component(Pagination.name, Pagination);
};
diff --git a/components/vc-pagination/Pagination.jsx b/components/vc-pagination/Pagination.jsx
index 784cc6af0..d3bd635e0 100644
--- a/components/vc-pagination/Pagination.jsx
+++ b/components/vc-pagination/Pagination.jsx
@@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
-import { hasProp, getOptionProps, getComponent } from '../_util/props-util';
+import { hasProp, getOptionProps, getComponent, splitAttrs } from '../_util/props-util';
import Pager from './Pager';
import Options from './Options';
import LOCALE from './locale/zh_CN';
@@ -30,10 +30,6 @@ export default {
name: 'Pagination',
mixins: [BaseMixin],
inheritAttrs: false,
- model: {
- prop: 'current',
- event: 'change.current',
- },
props: {
disabled: PropTypes.bool,
prefixCls: PropTypes.string.def('rc-pagination'),
@@ -241,7 +237,7 @@ export default {
this.$emit('update:pageSize', size);
this.$emit('showSizeChange', current, size);
if (current !== preCurrent) {
- this.$emit('change.current', current, size);
+ this.$emit('update:current', current);
}
},
handleChange(p) {
@@ -262,7 +258,7 @@ export default {
}
// this.$emit('input', page)
this.$emit('change', page, this.statePageSize);
- this.$emit('change.current', page, this.statePageSize);
+ this.$emit('update:current', page);
return page;
}
return this.stateCurrent;
@@ -314,7 +310,7 @@ export default {
},
render() {
const { prefixCls, disabled } = this.$props;
-
+ const { class: className, ...restAttrs } = splitAttrs(this.$attrs).extraAttrs;
// When hideOnSinglePage is true and there is only 1 page, hide the pager
if (this.hideOnSinglePage === true && this.total <= this.statePageSize) {
return null;
@@ -363,7 +359,7 @@ export default {
const hasNext = this.hasNext();
return (
-