动态修改全局page样式

const myPage = Page
Page = function (e) {
  let {
    onLoad
  } = e
  e.onLoad = (() => {
    return function (res) {
      wx.setPageStyle({
        style: {
          background: '#ccc'
        },
        success(e) {
          console.log(e)
        },
        fail(e) {
          console.log(e)
        }
      })
      // this为页面实例
      console.log('overWrite onLoad:', res, this)
      onLoad && onLoad.call(this, res)
    }
  })()
  return myPage.call(this, e)
}
原文地址:https://www.cnblogs.com/qianduanjingying/p/14062787.html