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,
3)在providers中
{ provide: HAMMER_GESTURE_CONFIG,useClass: ionicGalleryModal.GalleryModalHammerConfig,},
4)在使用时
import { GalleryModal } from 'ionic-gallery-modal';
beforePhotos: any[] = [];
this.beforePhotos.push({ url: base64Image });
let modal = this.modalCtrl.create(GalleryModal, {
hotos: this.beforePhotos ,
initialSlide: 0
});
modal.present();
ionic图片预览
最新推荐文章于 2023-10-26 11:09:24 发布