我想根据函数调用的返回值来确定css类,如下所示:
<ion-col style="getBooking(950)">
<div (tap)="this.makeOrRemoveBooking(950)">09:30</div>
</ion-col>
<ion-col style="this.getBooking(1000)">
<div (tap)="this.makeOrRemoveBooking(950)">10:00</div>
</ion-col>
<ion-col style="this.getBooking(1050)">
<div (tap)="this.makeOrRemoveBooking(950)">10:30</div>
</ion-col>
这是功能:
getBooking(time: number) {
for (const book of this.localListOfBookings) {
if (book.startTime <= time && time < book.endTime) {
if (book.bookedByName == this.currentUserName) {
return "yourRoom"
} else {
return "available"
}
// return book.bookedByName
}
}
}