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
    }
  }
}
作者 铁血 汉子 2018年6月5日
2018/10/22/06:36:26am 2018/6/5/6:21:13
0 715