OnLoad中SetData无效

onLoad(options) {
    let that = this
    let op = JSON.stringify(options)
    if (op !== '{}') {
      let redirectPg = options.page
      let bno = options.bno
      console.log('跳转目标页: '+redirectPg)
      console.log('容器编码: '+bno)
      app.globalData.redirectPage = redirectPg
      app.globalData.basketNo = bno
      // that.setData({
      //   redirectPage: redirectPg,
      //   basketNo: bno
      // }, ()=>{
      //   console.log('1. 目标页: '+ that.redirectPage+', 容器编码: '+ that.basketNo)
      // })
    } else {
      console.log('main.onLoad options is empty')
    }
  },
 
后来改为使用globalData折中下

posted on 2022-10-30 17:32  Mozzie2020  阅读(130)  评论(0编辑  收藏  举报

导航