和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

相關文章
相關標籤/搜索