|
@@ -1,6 +1,5 @@
|
|
|
-import { Component, Input } from '@angular/core';
|
|
|
+import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
|
|
import { IonicModule } from '@ionic/angular';
|
|
|
-import { Output, EventEmitter } from '@angular/core';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-task-card',
|
|
@@ -9,18 +8,23 @@ import { Output, EventEmitter } from '@angular/core';
|
|
|
standalone: true,
|
|
|
imports: [IonicModule]
|
|
|
})
|
|
|
-export class TaskCardComponent {
|
|
|
+export class TaskCardComponent implements OnInit {
|
|
|
@Input() id: string = '';
|
|
|
- @Input() title = '';
|
|
|
- @Input() tags: string[] = [];
|
|
|
- @Input() dueDate = '';
|
|
|
- @Input() dueTime = '';
|
|
|
+ @Input() title = '未命名任务';
|
|
|
+ @Input() tags: string[] = ['默认标签'];
|
|
|
+ @Input() dueDate: string = new Date().toLocaleDateString();
|
|
|
+ @Input() dueTime: string = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
|
@Input() subtasksCount = 0;
|
|
|
|
|
|
// 导入 Output 和 EventEmitter
|
|
|
@Output() cardClick = new EventEmitter<string>();
|
|
|
|
|
|
+ ngOnInit() {
|
|
|
+ console.log('卡片组件已初始化 | ID:', this.id, '标题:', this.title);
|
|
|
+ }
|
|
|
+
|
|
|
onClick() {
|
|
|
+ console.debug('[DEBUG] 卡片点击 | ID:', this.id);
|
|
|
this.cardClick.emit(this.id);
|
|
|
}
|
|
|
}
|