-1
我使用Ionic2解僱模式,我想設置模式頁面的中心,並點擊打開模式時,我想其他的頁面不透明度爲0.7和任意位置單擊時的模態解僱,這是我的HTML代碼:ionic2:如何從另一頁
<ion-header>
<ion-navbar color="dark">
<button ion-button icon-only menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Product</ion-title>
<ion-buttons end mode="md" (click)="sharePost()">
<button ion-button icon-only no-padding no-margin>
<ion-icon name="md-share"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content id="body" (click)="closeModal()">
</ion-content>
的.TS
import { ReviewPage } from '../review/review';
import { DescriptionPage } from '../description/description';
import { Component, ViewChild } from '@angular/core';
import { ModalController, NavController, NavParams, PopoverController,
ViewController } from 'ionic-angular';
import { ShareOptionsPage } from '../share-options/share-options';
@Component({
selector: 'page-product',
templateUrl: 'product.html',
})
export class ProductPage {
contactModal;
firstViewCtrl;
constructor(public modalCtrl: ModalController,public navCtrl:
NavController, public navParams: NavParams,public popoverCtrl:
PopoverController,public viewCtr:ViewController) {
}
sharePost() {
this.contactModal = this.modalCtrl.create(ShareOptionsPage,
{showBackdrop: true, enableBackdropDismiss: true});
this.contactModal.present();
this.firstViewCtrl = this.navCtrl.first();
}
closeModal() {
if(this.contactModal != null) {
this.firstViewCtrl.dismiss()
}
}
}
,但它不工作,我該怎麼辦?
肯定的,但如果我在產品頁面中使用viewCtrl.dismiss()它駁回商品頁面本身不是模式,我想解僱的模態,如果我在產品頁面的任何地方點擊,因爲是開放的在模式選項的頁面 –
enableBackdropDismiss的中間應對此進行處理 –