和app配合完成扫码任务并返回结果

一、定义好方法app的扫码方法ios

window.dadaInfo.getScancode(status)

注意:app端要写在dadaInfo对象下面 ios须要穿一个status参数,参数可任意app

二、定义js的方法供app调用,须要放在created里写一个全局方法this

created () {
var that = this
window.showCodeResult = function (res) {
      console.log('showCodeResult=>', res.result)
      if (!res && !res.result) {
        that.$storage.set('code', res.result)
        that.$router.push({ name: 'detail' })
      }
    }
}

注: 须要注意this指向问题code

相关文章
相关标签/搜索