收藏
回答

wx.getLocation怎么某些手机会有获取失败的情况?

wx.getLocation({

type: 'gcj02',

isHighAccuracy: true,

highAccuracyExpireTime: 4000,

success(res) {},

fail(res) {

console.log(res, "res");

wx.showModal({

title: "检测到您未开启手机定位,请先去设置中打开定位,开启后请点击'重进程序'",

confirmText: "重进程序",

cancelText: "返回首页",

success(res) {

if (res.confirm) {

wx.restartMiniProgram({

path: '/pages/index/index'

})

}

if (res.cancel) {

wx.navigateBack({

delta: 1

})

}

}

})

},

complete(res) {},

})

回答关注问题邀请回答
收藏
登录 后发表内容