小程序API调用报错:Can't find variable
发布于 7 年前 作者 jing73 2483 次浏览 来自 问答

开发工具上一切正常,但是在真机测试时 iphone6s(ios12) 报出此错误

checkAuth () {
  return _wx.run('getSetting').then(res => {
    if (res.authSetting["scope.userInfo"] && wx.getStorageSync('token')) return true
  })
},

/* _wx.run */
export function run(name, options = {}{
  return new Promise((resolve, reject) => {
    wx[name](Object.assign({}, options, {
      successres => {
        options.success && options.success(res)
        return resolve(res)
      },
      failres => {
        options.fail && options.fail(res)
        return reject(res)
      }
    }))
  })
}
1 回复

请具体描述问题出现的流程,并提供能复现问题的简单代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

回到顶部