This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

删除pages组件的调度代码;修复组件初始化时的旧回调

old
宇天 2018-01-01 13:02:53 +08:00
parent 7784e87511
commit d3ec859f24
2 changed files with 8 additions and 15 deletions

View File

@ -3435,15 +3435,13 @@
var componentQueue = []
var widgetList = []
var componentHooks = {
construct: function(props, state, next) {
next(props, state)
},
construct: noop,
componentWillMount: noop,
componentDidMount: noop,
childComponentDidMount: noop,
componentWillUnmount: noop,
render: function(str) {
return str
render: function() {
return null
}
}

View File

@ -37,16 +37,13 @@ function calculate({ currPage, maxPageShow, totalPages }) {
}
// 更新组件
function update(currPage, vm) {
const { totalPages, props } = vm
const { totalPages, props: { maxPageShow } } = vm
vm.currPage = vm.inputPage = currPage
vm.props.onPageChange.call(null, currPage)
if (totalPages < 2) {
return
}
vm.pageList.clear()
vm.pageList.pushArray(
calculate({ currPage, totalPages, maxPageShow: props.maxPageShow })
)
if (totalPages > 1) {
vm.pageList.pushArray(calculate({ currPage, totalPages, maxPageShow }))
}
}
export default Anot.component('pages', {
@ -84,7 +81,7 @@ export default Anot.component('pages', {
:attr="{href: parseUrl(totalPages)}"
:click="setPage(totalPages, $event)">{{props.btns.end}}</a>
<div class="input-box" :if="!props.simpleMode">
<div class="input-box" :if="!props.simpleMode && totalPages > 1">
<span> {{totalPages}} {{totalItems}} 前往</span>
<input type="text" :duplex="inputPage" :keyup="setPage(null, $event)">
<span></span>
@ -115,7 +112,6 @@ export default Anot.component('pages', {
return Math.ceil(this.totalItems / this.pageSize)
}
},
skip: ['currPage', 'totalItems', 'pageSize'],
props: {
url: null,
btns: {
@ -184,7 +180,6 @@ export default Anot.component('pages', {
update(1, this)
},
setTotalItems: function(num) {
console.log(this, num)
this.totalItems = +num
update(1, this)
}