getAddress() {
getJsSdkUiPackageAsync().then(res => {
if (res.Data.AppId) {
uni.setStorageSync('signature', res.Data)
this.getLocation(res.Data)
} else {
const signature = uni.getStorageSync('signature');
this.getLocation(signature)
console.log(signature)
}
})
},
getLocation(signature) {
jweixin.config({
debug: true,
"appId": signature.AppId,
"timestamp": signature.Timestamp,
"nonceStr": signature.NonceStr,
"signature": signature.Signature,
jsApiList: ["getLocation", "checkJsApi"] //根据需要看需要哪些SDK的功能
})
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: [
'getLocation'
],
success: function(res) {
if (res.checkResult.getLocation == false) {
alert('你的微信版本太低,不支持微信JS接口,请升级到最新的微信版本!');
return;
}
}
})
jweixin.getLocation({
type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
console.log(res)
}
});
})
},
返回为 :
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
at Function.remoteFunction (<anonymous>:2:14)