html52.com
我爱小程序-开发者交流社区

wx.openSetting方法在发布版下无法跳转设置页面,求解

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug wx.openSetting 客户端 6.7.3 2.4.0

- 当前 Bug 的表现(可附上截图)


相同的代码在体验版中测试点击定位事件后可以跳转到打开权限设置页面,但是发布后到版本点击无任何响应,求解


- 预期表现


- 复现路径


- 提供一个最简复现 Demo


定义一个locationUtil.js,添加以下方法,并在页面添加点击事件 (这里我用的是view的catchtap事件),调用该定位方法


const getLocation = (suceess,fail) => {

  if (wx.getLocation) {

    wx.getLocation({

      type: 'gcj02',

      success: function (res) {

        suceess(res);

      },

      fail: function (res) {

        wx.getSetting({

          success(res) {

            console.log(res);

            if (!res.authSetting['scope.userLocation']) {

              wx.openSetting({

              })

            } else {

              //打开选择地址

              wx.getLocation({

                type: 'gcj02',

                success: function (res) {

                  suceess(res);

                }

              })

            }

          },

          fail(res) {

            fail(res);

          }

        })

      }

    })

  }else {

    fail("不支持定位");

  }

}


module.exports = {

getLocation: getLocation

}


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付