|
@@ -1,4 +1,5 @@
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
|
|
+import { AlertController } from '@ionic/angular';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-tab1',
|
|
selector: 'app-tab1',
|
|
@@ -7,6 +8,45 @@ import { Component } from '@angular/core';
|
|
})
|
|
})
|
|
export class Tab1Page {
|
|
export class Tab1Page {
|
|
|
|
|
|
- constructor() {}
|
|
|
|
|
|
+ // constructor() {}
|
|
|
|
+
|
|
|
|
+ constructor(private alertController: AlertController) {}
|
|
|
|
+
|
|
|
|
+ handleImageClick(imageId: string) {
|
|
|
|
+ // 根据不同的图片ID执行不同的交互逻辑
|
|
|
|
+ switch (imageId) {
|
|
|
|
+ case 'recentUpdateImage1':
|
|
|
|
+ this.presentAlert('最近更新图片1被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ case 'recentUpdateImage2':
|
|
|
|
+ this.presentAlert('最近更新图片2被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ case 'recentUpdateImage3':
|
|
|
|
+ this.presentAlert('最近更新图片3被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ case 'hotMoviesImage1':
|
|
|
|
+ this.presentAlert('热门电影图片1被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ case 'hotMoviesImage2':
|
|
|
|
+ this.presentAlert('热门电影图片2被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ case 'hotMoviesImage3':
|
|
|
|
+ this.presentAlert('热门电影图片3被点击了!');
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ // 默认情况
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async presentAlert(message: string) {
|
|
|
|
+ const alert = await this.alertController.create({
|
|
|
|
+ header: '提示',
|
|
|
|
+ message: message,
|
|
|
|
+ buttons: ['确定']
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ await alert.present();
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|