1.获取用户信息
<button open-type="getUserInfo" @getuserinfo="bindGetUserInfo">进入帐篷,开始占卜</button>
methods:{ bindGetUserInfo (e) { var gender = e.mp.detail.userInfo.gender wx.setStorageSync('gender', gender) this.saveUserInfo() wx.navigateTo({url: '/pages/item/main'}) } }
2.获取保存图片到相册权限
<button v-if="!isAuthFlag" open-type="openSetting" @opensetting="authSetting">打开授权</button>
methods:{ authSetting (e) { if (e.mp.detail.authSetting['scope.writePhotosAlbum']) { this.isAuthFlag = true } } }