- 使用uniapp开发小程序获取用户信息按钮需要点击两次才能获得到用户信息?
用uniapp开发小程序,开发者工具本地测试没有问题,但是真机测试的时候获取用户信息那里不知道为何要点两次才能成功,第一次会提示错误 getUserProfile:fail can only be invoked by user TAP gesture 第二次才会成功,底下是我的代码 <button v-if="but" class='bottom' type='primary' @click="goLogin"> 获取用户信息 </button> getUserProfile() { // 判断缓存中是否有用户数据,没有则获取 uni.getUserProfile({ desc: '獲取您的昵稱、頭像、地區及性別', success: infoRes => { console.log('登陆成功', infoRes) if (infoRes.errMsg === 'getUserProfile:ok') { uni.showToast({ title: '授權成功', icon: 'success' }); } else { uni.showToast({ title: '授權失敗', icon: 'error' }); } }, fail: err => { console.log('userInfo-err', JSON.stringify(err)); } }); }, 我尝试过使用 <button v-if="but" class='bottom' type='primary' open-type="getUserProfile" bindtap="getUserProfile" > 获取用户信息 </button> 但是又会出现另外一个错误 "pages/login/login" does not have a method "getUserProfile" to handle event "tap"
2023-07-05 - 从后台获取到的生成二维码图片地址 偶尔会出现页面没有加载出来二维码图片的问题?
onLoad: function (options) { //获取到传过来的卡卷id this.data.lotteryHistoryId = options.lotteryHistoryId; //获取到传过来的车辆id this.data.carId = options.carId; this._loadData(this.data.carId, this.data.lotteryHistoryId); }, _loadData: function (carId, lotteryHistoryId){ //或者顶部高度 this.setData({ navH: app.globalData.navHeight }) //调用orcode-models中的getQrCode方法,传参卡卷id 车辆id 获取二维码图片地址 // Config.imgUrl线上路径 res.data.data图片地址 orcode.getQrCode(lotteryHistoryId, carId, (res) => { console.log('二维码图片') console.log(res.data.data) this.setData({ orCodeImage: Config.imgUrl + res.data.data }) }) }, [图片][图片] 通过在onLoad中调用方法wx.request请求后台 向后台传参数后获取到二维码图片地址 用setData渲染到wxml 获取到了图片地址但是偶尔会出现没有加载出来的情况 退出去重新获得就能显示出来这种是什么原因 该怎么优化呢?
2020-05-05 - 关于微信小程序个人认证和企业认证服务类目的区别?
做了一个有关车险的小程序 但是在微信小程序个人开放的服务类目表没有找到车险相关的类别 这种情况是否必须要转到企业认证上面才行?
2020-04-13