错误:无法将函数中未定义的属性x2设置为使用
x2 : string;
const provider = new OpenStreetMapProvider();
const results = provider.search({query : this.city}).then( function(e){
console.log("function(e)",e[0]);
this.x2=e[0].x;
});
答案 0 :(得分:0)
确定
x2 : string;
const provider = new OpenStreetMapProvider();
const results = provider.search({query : this.city}));
results.then( (e) => {
console.log("function(e)",e[0]);
this.x2=e[0].x;
}