|
@@ -1,7 +1,7 @@
|
|
|
-import { Component } from '@angular/core';
|
|
|
-import { FormsModule } from '@angular/forms'; // 导入 FormsModule 用于 ngModel(双向绑定)
|
|
|
-import { IonicModule } from '@ionic/angular'; // 必须导入 IonicModule,来使用 Ionic 组件
|
|
|
-import { CommonModule } from '@angular/common'; // 必须导入 CommonModule,来处理 ngIf、ngModel 等指令
|
|
|
+import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
|
+import { FormsModule } from '@angular/forms';
|
|
|
+import { IonicModule } from '@ionic/angular';
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-tab1',
|
|
@@ -9,13 +9,20 @@ import { CommonModule } from '@angular/common'; // 必须导入 CommonModule,
|
|
|
templateUrl: 'tab1.page.html',
|
|
|
styleUrls: ['tab1.page.scss'],
|
|
|
imports: [
|
|
|
- IonicModule, // 导入 IonicModule 来使用 IonHeader、IonToolbar 等组件
|
|
|
- CommonModule, // 导入 CommonModule 来使用结构指令(如 ngIf)
|
|
|
- FormsModule // 导入 FormsModule 用于 ngModel(双向绑定)
|
|
|
- ]
|
|
|
+ IonicModule,
|
|
|
+ CommonModule,
|
|
|
+ FormsModule
|
|
|
+ ],
|
|
|
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
|
})
|
|
|
export class Tab1Page {
|
|
|
- selectedTab: string = 'recommend'; // 默认选中 "推荐" 标签
|
|
|
+ selectedTab: string = 'recommend';
|
|
|
+
|
|
|
+ slides = [
|
|
|
+ { image: 'assets/1.png' },
|
|
|
+ { image: 'assets/2.png' },
|
|
|
+ { image: 'assets/3.png' },
|
|
|
+ ];
|
|
|
|
|
|
recommendations = [
|
|
|
{ title: '智能跑步机', subtitle: '最新款', description: '适合家庭使用的智能跑步机,享受便捷运动体验。', image: 'https://example.com/running-machine.jpg' },
|
|
@@ -46,4 +53,4 @@ export class Tab1Page {
|
|
|
enroll(course: { title: string; instructor: string; description: string }): void {
|
|
|
console.log('注册课程:', course);
|
|
|
}
|
|
|
-}
|
|
|
+}
|