我有异步函数,它接受参数。 当我在click.tirgger =“myFunc(param1,param2)”中调用它时,或者将其传递给子组件,因为回调参数不存在。 当我删除异步关键字时,一切都开始工作。
<button type="button" click.trigger="getPlayersData(currentPage)" class="btn btn-info col-lg-1">Show</button>
async getPlayersData(currentPage: number){
var data = await this.reportService.getPlayersData(start, end, currentPage, this.rowCount);
//do something
}
async getPlayersData(startDate, endDate, page, rowCount): Promise<ReportModel> {
try {
var response = await this.http.fetch('api/reportController/getPlayerBusinessReport?startDate=' + startDate + '&endDate=' + endDate + '&page=' + page + '&rowCount=' + rowCount, {
method: 'get'
});
var data = await response.json();
// form ReportModel object
//report = ReportModel(data)
return Promise.resolve(report);
}
catch (ex) {
//error handling
}
}
我怎么能解决这个问题?