- 全局变量头像和昵称不显示?
开发者版本号:2.14.1 win10 wxml: <view class="beijin"> <view class="topbox"> <view class="top1"> <view class="avator"> <image wx:if="{{user == 0 }}" src="../../images/avator.png"></image> <image src="{{user.avatarUrl}}"></image> </view> </view> <view class="top2"> <view class="nikname" wx:if="{{user == 0 }}" bindtap="go">点击登录</view> <view class="nikname" >{{user.nickName}}</view> </view> </view> js: const app = getApp() Page({ data: { }, onLoad() { console.log(app.globalData.userInfo) }, go() { wx.navigateTo({ url: '/pages/logs/logs', }) }, onReady: function () { }, onShow: function () { this.setData({ user: app.globalData.userInfo, }) }, logout() { wx.showLoading({ title: '退出登录中', }) setTimeout(function () { wx.hideLoading() }, 500) app.globalData.userInfo = null this.setData({ user: '' }) }, }) app.js // app.js App({ onLaunch: function () { if (!wx.cloud) { console.error('请使用 2.2.3 或以上的基础库以使用云能力'); } else { wx.cloud.init({ env: 'cloud1-3g7i9jh167406ff4', traceUser: true, }) var that = this; wx.cloud.callFunction({ name: 'getWxid', success:res=>{ console.log(res.result.openid) that.globalData.openid = res.result.openid //查找数据库有没有用户登录过的记录 wx.cloud.database().collection('superUser').where({ _openid: res.result.openid }).get({ success(result){ console.log(result) that.globalData.userInfo = result.data[0] } }) } }) } this. globalData = { userInfo:null, openid:null, nickName:null, avatarUrl:null } } }); [图片][图片][图片]我也不知道到底我错在哪
2022-06-24 - button open-type="getPhoneNumber" 没有授权弹窗?
版本号2.24.1 操作系统win10 再写 <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button> Page({ getPhoneNumber (e) { console.log(e.detail.code) } }) 的时候没有授权弹窗
2022-06-06 - 为什么我的微信小程序开发工具中本地设置没有npm模块的选项?
我也安装好了node.js和vant weapp了就是不见这个选项?? [图片]
2022-04-15