export function getgps() {
var j = 0;
var w = 0;
loadDDApi.then(() => {
dd.ready(() => {
// 获取当前地理位置信息(单次定位)
dd.device.geolocation.get({
targetAccuracy: 200,
coordinate: 1,
withReGeocode: true,
useCache: true,
onSuccess: function (result) {
var j = result.longitude;//这里经纬度赋值失败
var w = result.latitude//这里经纬度赋值失败
alert(result.longitude);//这里能正常弹窗提示经纬度的值
},
onFail: function (err) { }
});
})
})
this.$("textField_kybrsytl").setValue(j);//设置文本框,j的值还是0
this.$('numberField_kybrsytm').setValue(w);//设置数值框,w的值还是0
}
请问为什么设置选项框内容 j和w 为什么赋值变量失败了呢?