Ionic 2 InAppBrowser默认隐藏附件栏

时间:2016-08-24 12:31:49

标签: mobile ionic-framework ionic2 inappbrowser

我制作了我的第一个iOS应用程序,但我遇到了键盘问题。 你无法隐藏键盘。附件栏(带有关闭/上一个/下一个箭头)不可见。

另一个问题是登录后它不会自动关闭。因此,用户最终会在屏幕上显示键盘。它仅在您在网站内导航时关闭。

代码非常简单,该应用程序打开了InAppBrowser并加载了您需要登录的网站。

Login

After login

代码示例:

import {Component, ViewChild} from '@angular/core';
import {ionicBootstrap, Platform, MenuController, Nav} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HelloIonicPage} from './pages/hello-ionic/hello-ionic';
import {ListPage} from './pages/list/list';
import {InfoPage} from './pages/info/info';
import {InAppBrowser} from 'ionic-native';
import {Splashscreen} from 'ionic-native';
import {Keyboard} from 'ionic-native';

@Component({
  templateUrl: 'build/app.html'
})
class MyApp {
  @ViewChild(Nav) nav: Nav;

  // make HelloIonicPage the root (or first) page
  rootPage: any = HelloIonicPage;
  pages: Array<{title: string, component: any}>;
  inAppBrowserRef;

  constructor(
    private platform: Platform,
    private menu: MenuController
  ) {
    document.addEventListener('resume', () => {
        console.log("App has been resumed, reopen InAppBrowser url");
        this.openInAppBrowser();
    });
    this.initializeApp();

    // set our app's pages
    this.pages = [
      { title: 'Launch', component: HelloIonicPage },
      { title: 'Info', component: InfoPage }, 
    ];
  }

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      //Show previous/next/done button on keyboard
      this.openInAppBrowser();
    });
  }

  openInAppBrowser() {
    //Directly load website
    this.inAppBrowserRef = InAppBrowser.open("http://ws001.domeassistance.be:50001/", "_blank", "location=no,fullscreen=yes,toolbar=no,clearcache=yes,clearsessioncache=yes");
  }
}

ionicBootstrap(MyApp);

任何帮助?

//另一个谜团:在iOS上使用Phonegap进行调试时我会得到附件栏,但是当我将它构建成真正的应用程序时却没有?

// Edit2:如果我设置location = yes,那么Accessorybar会出现,但是我在页面底部看到一个讨厌的网址,这不是我想要的东西......

1 个答案:

答案 0 :(得分:0)

我使用_system代替_blank。然后我的键盘顶部栏有自动填充和完成按钮。

import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._

val window = Window.partitionBy("name").orderBy("date")
val lagCol = lag(col("date"), 1).over(window)
val diff = datediff(col("date"), col("previousDate"))
val level = when(
  col("previousDate").isNull || (diff <= 730), 1
).otherwise(2)

val newDF = empDF
  .where(col("code") === "C101")
  .withColumn("previousDate", lagCol)
  .withColumn("level", level)
  .drop("previousDate")

newDF.orderBy("id").show

+---+------+------+----+----------+-----+
| id|  name|emp_id|code|      date|level|
+---+------+------+----+----------+-----+
|  1|Andrew|   D01|C101|2012-06-14|    1|
|  2|James |   D02|C101|2013-02-26|    2|
|  4|James |   D02|C101|2010-09-27|    1|
+---+------+------+----+----------+-----+