// refresh the page __refreshBeforePage () { beforePage the let = getCurrentPages (). the Shift () // on a page instance object, getCurrentPages () to get the current page stack IF (beforePage == undefined || beforePage == null ) return // only refresh on a page is pagea / my / my page IF (beforePage.route == ' pages / my / my ' ) { beforePage.onLoad() } },
// next refresh a page __refreshNextPage () { nextPage the let = getCurrentPages (). POP () // next page instance object IF (nextPage undefined || nextPage == == null ) return nextPage.onLoad() },
requires attention:
When a page instance by obtaining an object, triggers the onLoad () to reload the previous / next page, the onLoad () must be reset before data can, this.setData ({user: res.data [0]})
If the onLoad () of the data splicing, this.setData ({jobs: oldData.concat (res.data)}), the refresh method that has to be wrong reasons:
The constant value oldData -> change the database oldData () the value of the page object trigger onLoad () -> oldData new res.data, but the page or the original value oldData, has not changed
__updateStatusTo0(id){ jobs.doc(id).update({ data: { Status: 0 // here modify the value of the database } }) .then (RES => { the this .__ refreshNextPage () // refresh Next job-manage, but the page the onLoad () is the data splicing processing, the original data will not change oldData }) },