|
@@ -14,15 +14,27 @@ import { IonHeader, IonToolbar, IonTitle, IonContent, IonFab, IonFabButton, IonI
|
|
})
|
|
})
|
|
export class Tab1Page {
|
|
export class Tab1Page {
|
|
currentDate: string;
|
|
currentDate: string;
|
|
|
|
+ cards: any[] = []; // 初始化空数组
|
|
|
|
|
|
- constructor(private dataService: DataService,private modalCtrl: ModalController) {this.currentDate = new Date().toLocaleDateString();}
|
|
|
|
|
|
+ constructor(private dataService: DataService, private modalCtrl: ModalController) {
|
|
|
|
+ this.currentDate = new Date().toLocaleDateString();
|
|
|
|
+ }
|
|
|
|
|
|
async openTaskModal() {
|
|
async openTaskModal() {
|
|
const modal = await this.modalCtrl.create({
|
|
const modal = await this.modalCtrl.create({
|
|
component: TaskModalComponent
|
|
component: TaskModalComponent
|
|
});
|
|
});
|
|
- return await modal.present();
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ modal.onDidDismiss().then(({ data }) => {
|
|
|
|
+ if (data) {
|
|
|
|
+ this.dataService.addCard(data);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ await modal.present();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ ngOnInit() {
|
|
|
|
+this.dataService.currentCards.subscribe(cards => this.cards = cards);
|
|
|
|
+ }
|
|
}
|
|
}
|