简体   繁体   中英

Ionic 3 Buttons are not clickable within ion-content

I've got buttons which are not clickable when within the ion-content. When I bring them out, they work just fine. Here's my HTML and SCSS. Very strange behavior, maybe I'm missing something?

<ion-content no-bounce>
  <div class="content_cover_exit">
    <button class="exit-button" (click)="logoutUser()">
      <ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
      EXIT
    </button>
  </div>
</ion-content>


  .content_cover_exit {
    width: 100%;
    text-align: center;
    position: fixed;
    bottom: 70px;
    z-index: 9999;
    margin-bottom: constant(safe-area-inset-bottom);
    margin-bottom: env(safe-area-inset-bottom);
  }
  .exit-button {
    height: 2.0em;
    border-radius: 5px;
    opacity: 100%;
    background-color: white;
    font-size: 0.8em;
    font-weight: 400;
    letter-spacing: 1.2px;
    color: $dark-text;
    z-index: 999999;
  }
  .exit-button.activated {
    background-color: white;

  }
  .icon-exit-class {
    color: $dark-text;
  }

UPDATE: Further research showed that even *ngIf doesn't work! this is begging to look super strange!

just add ion-button directive to you button tag and it will work fine.

ionic adds some enhanced with an ion-button directive.

<ion-content no-bounce>
  <div class="content_cover_exit">
    <button ion-button class="exit-button" (click)="logoutUser()">
      <ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
      EXIT
    </button>
  </div>
</ion-content>

try like this

 <ion-content no-bounce>
      <div class="content_cover_exit">
       <button class="exit-button"(click)="exitApp()">
          <ion-icon name="ios-exit-outline" class="icon-exit-class"></ion-icon>
          EXIT
      <button>
      </div>
    </ion-content>

and your

.ts

import {Platform} from 'ionic-angular';

export MyPage {


constructor(platform: Platform) {
    this.platform = platform;
  }
exitApp(){
 this.platform.exitApp();

} }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM