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 componentQueue = []
var widgetList = [] var widgetList = []
var componentHooks = { var componentHooks = {
construct: function(props, state, next) { construct: noop,
next(props, state)
},
componentWillMount: noop, componentWillMount: noop,
componentDidMount: noop, componentDidMount: noop,
childComponentDidMount: noop, childComponentDidMount: noop,
componentWillUnmount: noop, componentWillUnmount: noop,
render: function(str) { render: function() {
return str return null
} }
} }

View File

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