离子3离子导航点击问题

loading...


-1

这对我来说真的很奇怪,因为这个盒子没有出现在html上我事件试图删除所有html元素并且只保留按钮它仍然在那里阻止点击事件我甚至在窗口上测试点击事件但是它没有给我任何结果看到我画的绿框是我无法点击的地方

Box blocking the click image

Box blocking the click image

Screen Shot


UPDATE

The problem is for the entire app 所以我将分享app.component.ts注意这发生在ios手机上

<ion-header>
  <ion-navbar hideBackButton="true" class="navb">
    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
      <ion-icon name="arrow-forward"></ion-icon>
    </button>

    <ion-title class="tit" >{{"Al-Mamlaka Sweets" | translate}}</ion-title>

    <ion-buttons end>
      <button ion-button icon-only color="royal" (click)="navcart()" class="header-btn-cart">
        <ion-icon name="cart"></ion-icon>
        <ion-badge class="carts" item-right color="danger">{{noOfItems}}</ion-badge>
      </button>
    </ion-buttons>
  </ion-navbar>
</ion-header>


import { Component, ViewChild } from '@angular/core';
import { Nav, Platform, Events } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Service } from '../app/service';
import { OneSignal } from '@ionic-native/onesignal';
import { SocialSharing } from '@ionic-native/social-sharing';
import { SocketService } from '../providers/socket-service';
import { UserService } from '../providers/user-service';
import { TranslateService } from 'ng2-translate';
import { EmailComposer } from '@ionic-native/email-composer';
import { SettingsProvider } from "../providers/settings/settings";

@Component({
  templateUrl: 'app.html',
  selector: 'MyApp',
  providers: [Service, OneSignal, SocialSharing, EmailComposer,SettingsProvider]
})

export class MyApp {
  noOfItems: number;
  newsCounter: number;
  offerCounter = 0;
  @ViewChild(Nav) nav: Nav;
  rootPage: any;
  imageUrl: string = 'assets/img/logo_hori.png';
  value:any;
  constructor(public platform: Platform,
    public service: Service,
    public socketService: SocketService,
    private userService: UserService,
    statusBar: StatusBar,
    splashScreen: SplashScreen,
    public oneSignal: OneSignal,
    public socialSharing: SocialSharing,
    public events: Events,
    public translateService: TranslateService,
    public emailcomposer: EmailComposer,
    private set: SettingsProvider) {

      platform.ready().then((res) => {
        if (res == 'cordova') {
          const APP_ID = "";
          const senderId = '';
          this.oneSignal.startInit(APP_ID, senderId);
          this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);
          this.oneSignal.getIds().then((ids) => { console.log("ids"+JSON.stringify(ids)+"ids")});
          this.oneSignal.handleNotificationReceived().subscribe((res) => {
          });
          this.oneSignal.handleNotificationOpened().subscribe((res) => {
              let additionalData = res.notification.payload.additionalData;
              this.nav.push(additionalData.page,
                {id: additionalData.id}
              );
          });
          this.oneSignal.endInit();
        }
        statusBar.styleDefault();
        statusBar.overlaysWebView(false);
        statusBar.backgroundColorByHexString('#ff5d00');
        splashScreen.hide();
      });

      this.service.getData()
        .subscribe((response: any) => {
          this.newsCounter = response.newsList.length;
          for (let i = 0; i <= response.menuItems.length - 1; i++) {
            if (response.menuItems[i].offer != null) {
              this.offerCounter = this.offerCounter + 1;
            }
          }
        }, (error) => console.log(JSON.stringify(error)));
      this.getSettingInfo();
      translateService.setDefaultLang('ar');
      translateService.use('ar');
  }
  ionViewWillEnter(){
    this.useTranslateService();
  }
  ngOnInit(): any {
    if (!this.isLogin()) {
      this.rootPage = "HomePage";
      this.useTranslateService();
    } else {
      this.rootPage = "HomePage";
      this.socketService.establishConnection();
      this.renderImage();
      this.listenEvents();
      this.useTranslateService();
    }
  }

  // ngAfterViewInit() {
  //   this.nav.viewWillEnter.subscribe((view) => {
  //     let parentView = this.nav.getPrevious(view);
  //     if (parentView) {
  //       this.translateService.get('Back').subscribe(moduleName => this.nav.getActive().getNavbar().setBackButtonText(moduleName));
  //     }
  //   }); 
  // }

  getSettingInfo() {
    this.set.getSettings().subscribe((res: any) => {
      if (res != null && res.currency && res.currency.currencySign && res.currency.currencySign.symbol) {
        localStorage.setItem('currency', res.currency.currencySign.symbol);
      } else {
        localStorage.setItem('currency', ' SAR ');
      }
    }, (error) => console.log(JSON.stringify(error)));
  }

  private useTranslateService() {
    this.value = localStorage.getItem('language');
    let language = this.value != null ? this.value : 'ar';
    language == 'en' ? this.platform.setDir('ltr', true) : this.platform.setDir('rtl', true);
    this.translateService.use(language);
    localStorage.setItem('language',language);
  }

  private renderImage() {
    if (this.isLogin()) {
      this.userService.getUser()
        .subscribe((user: any) => {
          this.imageUrl = user.imageUrl != null ? this.imageUrl = user.imageUrl : this.imageUrl = 'assets/img/logo_hori.png';
        }, error => {
          this.nav.setRoot("LoginPage");
        })
    }
  }

  public listenEvents() {
    this.events.subscribe('imageUrl', (imageUrl) => {
      this.imageUrl = imageUrl;
      this.renderImage();
    })
  }

  isLogin() {
    return localStorage.getItem('token') != null;
  }

  home() {
    this.nav.setRoot("HomePage");
  }
  location() {
    this.nav.push("LocationPage");
  }
  sharelocation() {
    this.nav.push("SharelocationPage");
  }

  gotoCart() {
    this.nav.push("CartPage");
  }

  yourOrders() {
    this.nav.push("OrdersPage");
  }

  favourite() {
    this.nav.push("FavouritePage");
  }

  offer() {
    this.nav.push("OfferPage");
  }

  news() {
    this.nav.push("NewsPage");
  }

  contact() {
    let email = {
      to: 'info@mfc.sa',
      isHtml: true
    };
    this.emailcomposer.open(email);
  }

  settings() {
    this.nav.push("Settings");
  }

  aboutUs() {
    this.nav.push("AboutUsPage");
  }
  invite() {
    this.value
    let share = this.value === 'ar'? "شارك حلويات المملكة مع الأصدقاء": "Share Al-Mamlaka Sweets with friends"
    this.socialSharing.share(share, null, null, 'https://almamlakasweets.com');// do not forget the link 
  }

  orderStatus() {
    this.nav.push("OrderStatusPage");
  }
  login() {
    this.nav.setRoot("LoginPage");
  }

  logout() {
    localStorage.removeItem('token');
    this.events.publish('imageUrl', 'assets/img/logo_hori.png')
    this.nav.setRoot("LoginPage", {logout: true});
  }

  isCart() {
    let cart = JSON.parse(localStorage.getItem('cartItem'));
    cart != null ? this.noOfItems = cart.length : this.noOfItems = null;
    return true;
  }

}

loading...

0回答

No Data

评论

暂时没有评论!