var cityPromise = new Promise(function (resolve, reject) {
this.getAllCities();
this.cities = this.cities.filter(data => {
if (data.country_id === this.filCountry) {
return data;
}
});
resolve();
});
我需要等到响应从ajax调用到达,然后对接收到的数据执行操作吗?
答案 0 :(得分:0)
一旦承诺返回,您将使用then
:
cityPromise.then(data => {
// do something with data
})