typescript 如何在ionic 2中创建覆盖页面?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39221325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:48:14  来源:igfitidea点击:

How to create an overlay page in ionic 2?

angulartypescriptionic-frameworkionic2

提问by sridharan

How to creating an transparent guide overlay page when i enter into new page

进入新页面时如何创建透明指南覆盖页面

How can i implement in ionic 2 ?

我如何在 ionic 2 中实现?

enter image description here

在此处输入图片说明

回答by edi_smooth

You can just create div outside the <ion-content>:

您可以在 div 之外创建 div <ion-content>

<div class="my-overlay" padding [hidden]="overlayHidden">
    <button full (click)="hideOverlay()">Click me</button>
</div>

with CSS:

使用 CSS:

.my-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 20;
  top: 0;
  left: 0;
}

In class declaration add (before constructor):

在类声明中添加(在构造函数之前):

    overlayHidden: boolean = false;

and (after constructor):

和(在构造函数之后):

public hideOverlay() {
    this.overlayHidden = true;
}