有什么方法可以在ionic4应用程序内下载并打开ionic4项目?

时间:2019-08-08 14:19:24

标签: ionic3 ionic4

我有两个Ionic4项目。第一个项目(我称其为本机部分)将第二个项目下载到documents文件夹(ios)中,并打开路径。这是与ionic3完善。但是升级ionic4后,当下载完成并重新定位文件时,文件夹路径出现白屏。下载的项目无法正常工作。

我检查了下载的项目是否有错误,但是它可以正常工作。 如果我用基本的“ hello world”文本更改下载的项目index.html并删除所有js代码。这是工作。我认为问题出在我更改位置ionic项目未初始化时有关webview的问题。有人有解决方案吗?

ionic3-下载完成后,我会像打击一样调用gotoIndex方法。

gotoIndex() {
    console.log(“url: ”+document.location.href);
    console.log("index : " + this.dataDirectory + “index.html”);
    console.log(“indexe gidiliyor…”);
    let path = this.dataDirectory + “index.html”;
    if (this.os == “ios”) {
        path = normalizeURL(this.dataDirectory + “index.html”);
    } else if (this.os == “android”) {
        path = this.dataDirectory + “index.html”;
    }
    console.log("normalized path : " + path);
    document.location.href = path;
}

ionic4-ionic4中没有normalizeURL方法

gotoIndex() {
    console.log(“url: ”+document.location.href);
    let rootUrl = document.location.href;
    console.log("index : " + this.dataDirectory + “index.html”);
    console.log(“indexe gidiliyor…”);
    let path = this.dataDirectory + “index.html”;
    if (this.os == “ios”) {
        path = this.dataDirectory + “index.html”;

    } else if (this.os == "android") {
        path = this.dataDirectory + "android/" + "index.html";
    }
    console.log("org path : ", path);
    path = this.normalizePath(path);
    console.log("normalized path : " + path);
    document.location.href = path;
    //window.open(path);
}
normalizePath(path: string) {
    return this.webview.convertFileSrc(path)
}

I expect able to open downloaded ionic4 project but I see white screen error.

0 个答案:

没有答案