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日
2024/12/22/07:28:31am 2018/6/5/6:21:13
0 5721