|
|
@@ -1,12 +1,15 @@
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
-import { IonHeader, IonToolbar, IonTitle, IonContent, IonCard, IonCardContent, IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle, ModalController } from '@ionic/angular/standalone';
|
|
|
+import { FormsModule } from '@angular/forms';
|
|
|
+import { IonHeader, IonToolbar, IonTitle, IonContent, IonItem,IonCard, IonCardContent, IonLabel,IonList,IonInput,IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle, ModalController } from '@ionic/angular/standalone';
|
|
|
@Component({
|
|
|
selector: 'app-test',
|
|
|
templateUrl: './test.component.html',
|
|
|
styleUrls: ['./test.component.scss'],
|
|
|
standalone: true,
|
|
|
- imports: [IonHeader, IonToolbar, IonTitle, IonContent,
|
|
|
- IonCard, IonCardContent, IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle,
|
|
|
+ imports: [IonHeader, IonToolbar, IonTitle, IonContent, FormsModule, // 添加 FormsModule
|
|
|
+ CommonModule, // 确保 CommonModule 被导入
|
|
|
+ IonCard, IonCardContent, IonButton, IonCardHeader, IonCardTitle, IonCardSubtitle,IonItem,IonLabel,IonInput,IonList
|
|
|
],
|
|
|
})
|
|
|
export class TestComponent implements OnInit {
|
|
|
@@ -15,4 +18,13 @@ export class TestComponent implements OnInit {
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
+ newMemo: string = ''; // 新备忘录内容
|
|
|
+ memos: string[] = []; // 储存备忘录的数组
|
|
|
+
|
|
|
+ addMemo() {
|
|
|
+ if (this.newMemo.trim()) {
|
|
|
+ this.memos.push(this.newMemo.trim());
|
|
|
+ this.newMemo = ''; // 清空输入框
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|