lookforcustomers(value){
if(value=='on'){
var refs=this.state;
async function getnearplaces(refi){
console.log('timer runnning')
this.ref=refi;
var driverpoint = new Parse.GeoPoint({latitude:this.ref.state.lastknownlocation.latitude, longitude:this.ref.state.lastknownlocation.longitude});
var GameScore = Parse.Object.extend("Booking");
const query = new Parse.Query(PlaceObject);
query.equalTo("hired",false);
query.near("pick", driverpoint);
query.limit(1);
const placesObjects = await query.find().then((object) => {
console.log(object[0])
}, (error) => {
console.log('error while looking for the customers')
});
}
this.intervalid=setInterval(getnearplaces(this.refs), 10000);
}
else {
clearInterval(this.intervalid)
}
}
执行此方法时遇到错误
错误 func.apply不是函数
我从组件中的渲染方法中执行外观查找客户方法,但我没有出错,但是当我尝试更正代码时,仍然无法从状态对象获取状态值, 我的目的是获取状态值,并将其设置为解析地理位置,以吸引客户,因为我一直在尝试获取该值