位置:首页 » 文章/教程分享 » 微信小程序判断值是否存在

微信小程序,多个页面之间传递值,用来判断是否传入值。或者用来判断是否是微信,扫描带参数的二维码进入。

代码如下:

onLoad: function (!options) {
  var that = this;
  if(options){
    console.log('无传入值,不是经过扫码进入的。我是空')
  }
  else if(options.profit.length >6){
    that.setData({
      dyProfit: options.profit
    })
  }
}