【问下】wx.openSetting()?

发布于 8 年前作者 juanzeng8305 次浏览最后编辑 8 年前来自 ask
wx.getSetting({
      success: (res) => {
        if (!res.authSetting['scope.writePhotosAlbum']) {
          
          wx.authorize({
            scope: 'scope.writePhotosAlbum',
            success: () => {
              // 同意授权
            },
            fail: (res) => {
              // 无法唤醒设置
              wx.openSetting()
            }
          })
        } else {
          // 已经授权了
        }
      },
      fail: (res) => {
        console.log(res);
      }
    }) 
3 回复
gangdu
gangdu1 楼6 年前

我就知道,微信小程序,不是坑用户来了,就是坑我们来了

wei88
wei882 楼6 年前
 setTimeout(function() {
      wx.openSetting({
        success(res) {
          console.log(res.authSetting)
        }
      })
    }, 1000)

这种也是不支持的

min06
min063 楼6 年前

尝试过可以。需要用户点击后判断。查看代码片段:

https://developers.weixin.qq.com/community/develop/article/doc/000ac686c5c5506f18b87ee825b013