1.插件安装
npm install ionic-gallery-modal --save
2.在app.module.ts引入
import * as ionicGalleryModal from 'ionic-gallery-modal';import { HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';imports: [//...ionicGalleryModal.GalleryModalModule,//...],providers: [//...{provide: HAMMER_GESTURE_CONFIG,useClass: ionicGalleryModal.GalleryModalHammerConfig,},//...],
3.在对应的组建ts中使用
private photos: any[] = [];showbigpicture(pirtrue, num) {let photos = [{url:'http:xxxxxxx .png' , title:'xxx'},{url:'http:xxxxxxx .png' , title:'xxx'},{url:'http:xxxxxxx .png' , title:'xxx'},]//此处photos换成自己需要的路径let modal = this.modalCtrl.create(GalleryModal, {photos: photos ,initialSlide: num, // The second image});modal.present();}
到这基本就可以使用了(有帮助的话,点个赞哟(⊙o⊙)…)