PhoneGap 不在移动设备上显示页面
PhoneGap not displaying pages on mobile
我正在尝试使用 PhoneGap build 部署移动网络应用程序。 webapp是运行到Docker,前端使用HTML,CSS,JS,连接一个Python,Apache,SQL 后端服务器,运行 到 docker。
这作为网站运行良好,并在移动网络浏览器上正确显示。但是,当我尝试使用 phonegap build 打包应用程序时,它仅显示 index.html 页面。
我认为这可能是我为我的 webapp 使用的模型视图控制器设置的问题(以便在 1 个页面中加载多个页面)
得到的页面如下:
downloadTemplate (templateName, downloadCallback)
{
var that = this;
var url = window.location.href+"/views/"+templateName+"/"+templateName+".html";
var url = cordova.file.applicationDirectory+"/views/"+templateName+"/"+templateName+".html";
var header = document.getElementById("header-label");
header.value = url;
header.innerHTML = header.value;
var xhr = new XMLHttpRequest();
console.log("url: " + url);
xhr.onload = function()
{
var el = document.createElement( 'html' );
el.innerHTML = xhr.responseText;
//get body
el = el.getElementsByTagName("body")[0];
//console.log("el: " + el);
//store the template
that.cache[templateName] = el;
that.successCount++;
if (that.isDone())
{
downloadCallback();
}
};
xhr.onerror = function()
{
that.errorCount++;
if (that.isDone())
{
downloadCallback();
}
};
xhr.open("GET", url);
xhr.send();
}
第一个变量 url 适用于该网站,如您所见,我正在尝试使用 cordova 插件(在您构建应用程序时提供)复制 href。
令我失望的是,这在使用 phonegap build 时不起作用。但是,我下载了 phonegap desktop,将我的代码放入 www 文件夹中,并且我能够使用它提供的浏览器平台使其工作。
因此它可以通过浏览器在模拟构建体验上显示,但在 android 或 iOS 上都不起作用。但是,出于某种原因,当我也连接到我的 docker-python-websocket(获取用户配置文件等数据所必需的)时,网站速度变慢并变得无法使用。许多 JS 功能似乎也无用/无法工作/未连接。
我几乎浏览了关于 phonegap 的每一页文档/文章,以及关于 ionic、cordova、stack、youtube 和各种较小站点的更多文档/文章,但没有找到任何帮助。甚至没有可以帮助我重构项目的多页项目示例。
这是我的 index.html(大部分 js 和 css 文件被省略,但示例仍然存在):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<!--PhoneGap Setup - was originally in body, but moved here as cordova doesn't load in fast enough for when it's used in the function above -->
<!-- <link rel="stylesheet" type="text/css" href="css/index.css" />
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div> -->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
PGA.initialize();
</script>
<!--App Name-->
<title>App Name</title>
<!--API's-->
<link href='https://fonts.googleapis.com/css?family=Bangers' rel='stylesheet'>
<link href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin" rel="stylesheet" type="text/css" >
<!--Icon-->
<link rel="icon" href="favicon.ico">
<link rel="shortcut icon" href="favicon.ico">
<!--APP css-->
<link rel="stylesheet" href="css/box.css">
<link rel="stylesheet" href="css/colors.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/dashboard.css">
<link rel="stylesheet" href="css/defaults.css">
<link rel="stylesheet" href="css/overlay.css">
<link rel="stylesheet" href="css/sidebar.css">
<!--App js-->
<script src = "js/App.js"></script>
<!--App lib-->
<script src = "lib/ViewManager/ViewManager.js"></script>
<script src = "lib/ViewManager/Model.js"></script>
<script src = "lib/ViewManager/View.js"></script>
<script src = "lib/ViewManager/TemplateManager.js"></script>
<!--App models-->
<script src = "models/User.js"></script>
<!--Splash Screen-->
<script src = "views/splash/SplashController.js"></script>
<script src = "views/splash/SplashView.js"></script>
<link rel="stylesheet" href="views/splash/splash.css">
</head>
<body onload="main()"> <!-- This is how my website code works, creating a class "app" in js once the body loads -->
<!--Side Bar-->
<div class="header" id="app-header">
<p id="header-label"> Sport Craft </p>
<button class="hamburger" id="hamburger"></button>
</div>
<div class="side-bar" id="app-sidebar">
<ul>
<li id="sb-header">Options:</li>
<li id="sb-logout">Sign Out</li>
<li id="sb-cc">Pending</li>
<li id="manager-gr">Get Requests</li>
<li id="sb-back">Back</li>
<li id="sb-download">Download</li>
</ul>
</div>
<div class="side-bar-exit" id="app-sidebar-exit"></div>
<!--Pop Up-->
<div class="logpopup" id="achievement-unlock-pop">
<div id="achievement-unlock-pop-image"></div>
<label id="achievement-unlock-pop-title"> Title</label>
</div>
<div class="logpopup" id="logpopup">
<div id="lpu-header"><label>Logged</label></div>
<label id="lpu-text"></label>
<button class="exit" id="lpu-exit">X</button>
</div>
<!--Start Up Screen-->
<script src = "views/signin/SigninController.js"></script>
<script src = "views/signin/SigninView.js"></script>
<link rel="stylesheet" href="views/signin/signin.css">
<script src = "views/signup/SignupController.js"></script>
<script src = "views/signup/SignupView.js"></script>
<link rel="stylesheet" href="views/signup/signup.css">
<script src = "views/club/ClubController.js"></script>
<script src = "views/club/ClubView.js"></script>
<link rel="stylesheet" href="views/club/club.css">
<!--User Screens-->
<script src = "views/player/PlayerController.js"></script>
<script src = "views/player/PlayerView.js"></script>
<link rel="stylesheet" href="views/player/player.css">
<link rel="stylesheet" href="views/player/overlookbar.css">
<link rel="stylesheet" href="views/player/boxes.css">
<link rel="stylesheet" href="views/player/calc.css">
<script src = "views/manager/ManagerController.js"></script>
<script src = "views/manager/ManagerView.js"></script>
<link rel="stylesheet" href="views/manager/manager.css">
</body>
</html>
这是我的配置文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="ie.example.example.example"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0">
<name>App Name</name>
<description>
Phone Gap App.
</description>
<author email="me@email.ie" href="http://example.example.ie">
My Name
</author>
<content src="index.html" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="14" />
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="true" />
<plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1" />
<plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1" />
<plugin name="cordova-plugin-media-capture" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-console" source="npm" spec="~1.0.2" />
<plugin name="cordova-plugin-contacts" source="npm" spec="~2.0.1" />
<plugin name="cordova-plugin-device" source="npm" spec="~1.1.1" />
<plugin name="cordova-plugin-device-motion" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2" />
<plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />
<plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0" />
<plugin name="cordova-plugin-geolocation" source="npm" spec="~2.1.0" />
<plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.3" />
<plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />
<plugin name="cordova-plugin-media" source="npm" spec="~2.2.0" />
<plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />
<plugin name="cordova-plugin-vibration" source="npm" spec="~2.1.0" />
<plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />
<platform name="android">
<icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />
<icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />
<icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="www/res/screen/android/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="www/res/screen/android/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="www/res/screen/android/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="www/res/screen/android/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="www/res/screen/android/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<icon height="57" platform="ios" src="www/res/icon/ios/icon.png" width="57" />
<icon height="114" platform="ios" src="www/res/icon/ios/icon@2x.png" width="114" />
<icon height="40" platform="ios" src="www/res/icon/ios/icon-40.png" width="40" />
<icon height="80" platform="ios" src="www/res/icon/ios/icon-40@2x.png" width="80" />
<icon height="50" platform="ios" src="www/res/icon/ios/icon-50.png" width="50" />
<icon height="100" platform="ios" src="www/res/icon/ios/icon-50@2x.png" width="100" />
<icon height="60" platform="ios" src="www/res/icon/ios/icon-60.png" width="60" />
<icon height="120" platform="ios" src="www/res/icon/ios/icon-60@2x.png" width="120" />
<icon height="180" platform="ios" src="www/res/icon/ios/icon-60@3x.png" width="180" />
<icon height="72" platform="ios" src="www/res/icon/ios/icon-72.png" width="72" />
<icon height="144" platform="ios" src="www/res/icon/ios/icon-72@2x.png" width="144" />
<icon height="76" platform="ios" src="www/res/icon/ios/icon-76.png" width="76" />
<icon height="152" platform="ios" src="www/res/icon/ios/icon-76@2x.png" width="152" />
<icon height="29" platform="ios" src="www/res/icon/ios/icon-small.png" width="29" />
<icon height="58" platform="ios" src="www/res/icon/ios/icon-small@2x.png" width="58" />
<icon height="87" platform="ios" src="www/res/icon/ios/icon-small@3x.png" width="87" />
<splash height="1136" platform="ios" src="www/res/screen/ios/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" platform="ios" src="www/res/screen/ios/Default-667h.png" width="750" />
<splash height="2208" platform="ios" src="www/res/screen/ios/Default-736h.png" width="1242" />
<splash height="1242" platform="ios" src="www/res/screen/ios/Default-Landscape-736h.png" width="2208" />
<splash height="1536" platform="ios" src="www/res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="768" platform="ios" src="www/res/screen/ios/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" platform="ios" src="www/res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1024" platform="ios" src="www/res/screen/ios/Default-Portrait~ipad.png" width="768" />
<splash height="960" platform="ios" src="www/res/screen/ios/Default@2x~iphone.png" width="640" />
<splash height="480" platform="ios" src="www/res/screen/ios/Default~iphone.png" width="320" />
</platform>
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
phonegap 提供的 weinre 调试器能够检测到 html 个元素,但不显示任何其他元素。
如果有人有 Git 示例说明具有多个 html 页面的完整项目如何工作,那将非常有帮助(特别是如果它连接到外部服务器以进行数据管理)。
编辑
我通过更改将页面加载到设备上:
var url = cordova.file.applicationDirectory+"www/views/"+templateName+"/"+templateName+".html";
但是,就像浏览器一样,这些页面缺少所有功能
该文件被编译到一个目录,该目录表示包含您的 config.xml 文件的文件夹。
您可以使用以下方式访问此文件夹:
cordova.file.applicationDirectory
其中returns一个字符串。那么www文件夹的内容是:
cordova.file.applicationDirectory + "www/" + {what you're looking for}
此外,请确保您遵循 PhoneGap 文档中列出的 CLI 项目应用程序结构:
http://docs.phonegap.com/phonegap-build/getting-started/app-project-structure/
至于卡顿的问题,是随机出现的,一直没能重现。
我正在尝试使用 PhoneGap build 部署移动网络应用程序。 webapp是运行到Docker,前端使用HTML,CSS,JS,连接一个Python,Apache,SQL 后端服务器,运行 到 docker。
这作为网站运行良好,并在移动网络浏览器上正确显示。但是,当我尝试使用 phonegap build 打包应用程序时,它仅显示 index.html 页面。
我认为这可能是我为我的 webapp 使用的模型视图控制器设置的问题(以便在 1 个页面中加载多个页面)
得到的页面如下:
downloadTemplate (templateName, downloadCallback)
{
var that = this;
var url = window.location.href+"/views/"+templateName+"/"+templateName+".html";
var url = cordova.file.applicationDirectory+"/views/"+templateName+"/"+templateName+".html";
var header = document.getElementById("header-label");
header.value = url;
header.innerHTML = header.value;
var xhr = new XMLHttpRequest();
console.log("url: " + url);
xhr.onload = function()
{
var el = document.createElement( 'html' );
el.innerHTML = xhr.responseText;
//get body
el = el.getElementsByTagName("body")[0];
//console.log("el: " + el);
//store the template
that.cache[templateName] = el;
that.successCount++;
if (that.isDone())
{
downloadCallback();
}
};
xhr.onerror = function()
{
that.errorCount++;
if (that.isDone())
{
downloadCallback();
}
};
xhr.open("GET", url);
xhr.send();
}
第一个变量 url 适用于该网站,如您所见,我正在尝试使用 cordova 插件(在您构建应用程序时提供)复制 href。
令我失望的是,这在使用 phonegap build 时不起作用。但是,我下载了 phonegap desktop,将我的代码放入 www 文件夹中,并且我能够使用它提供的浏览器平台使其工作。
因此它可以通过浏览器在模拟构建体验上显示,但在 android 或 iOS 上都不起作用。但是,出于某种原因,当我也连接到我的 docker-python-websocket(获取用户配置文件等数据所必需的)时,网站速度变慢并变得无法使用。许多 JS 功能似乎也无用/无法工作/未连接。
我几乎浏览了关于 phonegap 的每一页文档/文章,以及关于 ionic、cordova、stack、youtube 和各种较小站点的更多文档/文章,但没有找到任何帮助。甚至没有可以帮助我重构项目的多页项目示例。
这是我的 index.html(大部分 js 和 css 文件被省略,但示例仍然存在):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<!--PhoneGap Setup - was originally in body, but moved here as cordova doesn't load in fast enough for when it's used in the function above -->
<!-- <link rel="stylesheet" type="text/css" href="css/index.css" />
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div> -->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
PGA.initialize();
</script>
<!--App Name-->
<title>App Name</title>
<!--API's-->
<link href='https://fonts.googleapis.com/css?family=Bangers' rel='stylesheet'>
<link href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin" rel="stylesheet" type="text/css" >
<!--Icon-->
<link rel="icon" href="favicon.ico">
<link rel="shortcut icon" href="favicon.ico">
<!--APP css-->
<link rel="stylesheet" href="css/box.css">
<link rel="stylesheet" href="css/colors.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/dashboard.css">
<link rel="stylesheet" href="css/defaults.css">
<link rel="stylesheet" href="css/overlay.css">
<link rel="stylesheet" href="css/sidebar.css">
<!--App js-->
<script src = "js/App.js"></script>
<!--App lib-->
<script src = "lib/ViewManager/ViewManager.js"></script>
<script src = "lib/ViewManager/Model.js"></script>
<script src = "lib/ViewManager/View.js"></script>
<script src = "lib/ViewManager/TemplateManager.js"></script>
<!--App models-->
<script src = "models/User.js"></script>
<!--Splash Screen-->
<script src = "views/splash/SplashController.js"></script>
<script src = "views/splash/SplashView.js"></script>
<link rel="stylesheet" href="views/splash/splash.css">
</head>
<body onload="main()"> <!-- This is how my website code works, creating a class "app" in js once the body loads -->
<!--Side Bar-->
<div class="header" id="app-header">
<p id="header-label"> Sport Craft </p>
<button class="hamburger" id="hamburger"></button>
</div>
<div class="side-bar" id="app-sidebar">
<ul>
<li id="sb-header">Options:</li>
<li id="sb-logout">Sign Out</li>
<li id="sb-cc">Pending</li>
<li id="manager-gr">Get Requests</li>
<li id="sb-back">Back</li>
<li id="sb-download">Download</li>
</ul>
</div>
<div class="side-bar-exit" id="app-sidebar-exit"></div>
<!--Pop Up-->
<div class="logpopup" id="achievement-unlock-pop">
<div id="achievement-unlock-pop-image"></div>
<label id="achievement-unlock-pop-title"> Title</label>
</div>
<div class="logpopup" id="logpopup">
<div id="lpu-header"><label>Logged</label></div>
<label id="lpu-text"></label>
<button class="exit" id="lpu-exit">X</button>
</div>
<!--Start Up Screen-->
<script src = "views/signin/SigninController.js"></script>
<script src = "views/signin/SigninView.js"></script>
<link rel="stylesheet" href="views/signin/signin.css">
<script src = "views/signup/SignupController.js"></script>
<script src = "views/signup/SignupView.js"></script>
<link rel="stylesheet" href="views/signup/signup.css">
<script src = "views/club/ClubController.js"></script>
<script src = "views/club/ClubView.js"></script>
<link rel="stylesheet" href="views/club/club.css">
<!--User Screens-->
<script src = "views/player/PlayerController.js"></script>
<script src = "views/player/PlayerView.js"></script>
<link rel="stylesheet" href="views/player/player.css">
<link rel="stylesheet" href="views/player/overlookbar.css">
<link rel="stylesheet" href="views/player/boxes.css">
<link rel="stylesheet" href="views/player/calc.css">
<script src = "views/manager/ManagerController.js"></script>
<script src = "views/manager/ManagerView.js"></script>
<link rel="stylesheet" href="views/manager/manager.css">
</body>
</html>
这是我的配置文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="ie.example.example.example"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0">
<name>App Name</name>
<description>
Phone Gap App.
</description>
<author email="me@email.ie" href="http://example.example.ie">
My Name
</author>
<content src="index.html" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="14" />
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="true" />
<plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1" />
<plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1" />
<plugin name="cordova-plugin-media-capture" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-console" source="npm" spec="~1.0.2" />
<plugin name="cordova-plugin-contacts" source="npm" spec="~2.0.1" />
<plugin name="cordova-plugin-device" source="npm" spec="~1.1.1" />
<plugin name="cordova-plugin-device-motion" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2" />
<plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />
<plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0" />
<plugin name="cordova-plugin-geolocation" source="npm" spec="~2.1.0" />
<plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.3" />
<plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />
<plugin name="cordova-plugin-media" source="npm" spec="~2.2.0" />
<plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />
<plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />
<plugin name="cordova-plugin-vibration" source="npm" spec="~2.1.0" />
<plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />
<platform name="android">
<icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />
<icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />
<icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="www/res/screen/android/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="www/res/screen/android/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="www/res/screen/android/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="www/res/screen/android/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="www/res/screen/android/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<icon height="57" platform="ios" src="www/res/icon/ios/icon.png" width="57" />
<icon height="114" platform="ios" src="www/res/icon/ios/icon@2x.png" width="114" />
<icon height="40" platform="ios" src="www/res/icon/ios/icon-40.png" width="40" />
<icon height="80" platform="ios" src="www/res/icon/ios/icon-40@2x.png" width="80" />
<icon height="50" platform="ios" src="www/res/icon/ios/icon-50.png" width="50" />
<icon height="100" platform="ios" src="www/res/icon/ios/icon-50@2x.png" width="100" />
<icon height="60" platform="ios" src="www/res/icon/ios/icon-60.png" width="60" />
<icon height="120" platform="ios" src="www/res/icon/ios/icon-60@2x.png" width="120" />
<icon height="180" platform="ios" src="www/res/icon/ios/icon-60@3x.png" width="180" />
<icon height="72" platform="ios" src="www/res/icon/ios/icon-72.png" width="72" />
<icon height="144" platform="ios" src="www/res/icon/ios/icon-72@2x.png" width="144" />
<icon height="76" platform="ios" src="www/res/icon/ios/icon-76.png" width="76" />
<icon height="152" platform="ios" src="www/res/icon/ios/icon-76@2x.png" width="152" />
<icon height="29" platform="ios" src="www/res/icon/ios/icon-small.png" width="29" />
<icon height="58" platform="ios" src="www/res/icon/ios/icon-small@2x.png" width="58" />
<icon height="87" platform="ios" src="www/res/icon/ios/icon-small@3x.png" width="87" />
<splash height="1136" platform="ios" src="www/res/screen/ios/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" platform="ios" src="www/res/screen/ios/Default-667h.png" width="750" />
<splash height="2208" platform="ios" src="www/res/screen/ios/Default-736h.png" width="1242" />
<splash height="1242" platform="ios" src="www/res/screen/ios/Default-Landscape-736h.png" width="2208" />
<splash height="1536" platform="ios" src="www/res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="768" platform="ios" src="www/res/screen/ios/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" platform="ios" src="www/res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1024" platform="ios" src="www/res/screen/ios/Default-Portrait~ipad.png" width="768" />
<splash height="960" platform="ios" src="www/res/screen/ios/Default@2x~iphone.png" width="640" />
<splash height="480" platform="ios" src="www/res/screen/ios/Default~iphone.png" width="320" />
</platform>
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
phonegap 提供的 weinre 调试器能够检测到 html 个元素,但不显示任何其他元素。
如果有人有 Git 示例说明具有多个 html 页面的完整项目如何工作,那将非常有帮助(特别是如果它连接到外部服务器以进行数据管理)。
编辑
我通过更改将页面加载到设备上:
var url = cordova.file.applicationDirectory+"www/views/"+templateName+"/"+templateName+".html";
但是,就像浏览器一样,这些页面缺少所有功能
该文件被编译到一个目录,该目录表示包含您的 config.xml 文件的文件夹。
您可以使用以下方式访问此文件夹:
cordova.file.applicationDirectory
其中returns一个字符串。那么www文件夹的内容是:
cordova.file.applicationDirectory + "www/" + {what you're looking for}
此外,请确保您遵循 PhoneGap 文档中列出的 CLI 项目应用程序结构:
http://docs.phonegap.com/phonegap-build/getting-started/app-project-structure/
至于卡顿的问题,是随机出现的,一直没能重现。