|
|
@ -32,7 +32,6 @@ export default {
|
|
|
|
total: PropTypes.number.def(0),
|
|
|
|
total: PropTypes.number.def(0),
|
|
|
|
pageSize: PropTypes.number,
|
|
|
|
pageSize: PropTypes.number,
|
|
|
|
defaultPageSize: PropTypes.number.def(10),
|
|
|
|
defaultPageSize: PropTypes.number.def(10),
|
|
|
|
change: PropTypes.func.def(noop),
|
|
|
|
|
|
|
|
hideOnSinglePage: PropTypes.bool.def(false),
|
|
|
|
hideOnSinglePage: PropTypes.bool.def(false),
|
|
|
|
showSizeChanger: PropTypes.bool.def(false),
|
|
|
|
showSizeChanger: PropTypes.bool.def(false),
|
|
|
|
showLessItems: PropTypes.bool.def(false),
|
|
|
|
showLessItems: PropTypes.bool.def(false),
|
|
|
@ -50,7 +49,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
model: {
|
|
|
|
model: {
|
|
|
|
prop: 'current',
|
|
|
|
prop: 'current',
|
|
|
|
event: 'change',
|
|
|
|
event: 'change.current',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
data () {
|
|
|
|
const hasOnChange = this.onChange !== noop
|
|
|
|
const hasOnChange = this.onChange !== noop
|
|
|
@ -174,6 +173,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
changePageSize (size) {
|
|
|
|
changePageSize (size) {
|
|
|
|
let current = this.stateCurrent
|
|
|
|
let current = this.stateCurrent
|
|
|
|
|
|
|
|
const preCurrent = current
|
|
|
|
const newCurrent = this.calculatePage(size)
|
|
|
|
const newCurrent = this.calculatePage(size)
|
|
|
|
current = current > newCurrent ? newCurrent : current
|
|
|
|
current = current > newCurrent ? newCurrent : current
|
|
|
|
// fix the issue:
|
|
|
|
// fix the issue:
|
|
|
@ -196,7 +196,9 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.$emit('update:pageSize', size)
|
|
|
|
this.$emit('update:pageSize', size)
|
|
|
|
this.$emit('showSizeChange', current, size)
|
|
|
|
this.$emit('showSizeChange', current, size)
|
|
|
|
this.$emit('change', current, size)
|
|
|
|
if (current !== preCurrent) {
|
|
|
|
|
|
|
|
this.$emit('change.current', current, size)
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handleChange (p) {
|
|
|
|
handleChange (p) {
|
|
|
|
let page = p
|
|
|
|
let page = p
|
|
|
@ -213,6 +215,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this.$emit('input', page)
|
|
|
|
// this.$emit('input', page)
|
|
|
|
this.$emit('change', page, this.statePageSize)
|
|
|
|
this.$emit('change', page, this.statePageSize)
|
|
|
|
|
|
|
|
this.$emit('change.current', page, this.statePageSize)
|
|
|
|
return page
|
|
|
|
return page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.stateCurrent
|
|
|
|
return this.stateCurrent
|
|
|
|