import Taro from '@tarojs/taro' // https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html /** * 微信授权 * @param {*} scope */ export function authorize(scope) { return new Promise((resolve, reject) => { Taro.getSetting({ success: function (res) { if (!res.authSetting[scope]) { Taro.authorize({ scope, success: resolve, fail: reject, }) } else { resolve() } }, fail: reject, }) }) }