我创建示例cordova应用程序模板,在 www 目录中实现我的代码,然后在浏览器Chrome,Edge,Firefox中运行,一切正常。
cordova run browser
但是如果我执行
cordova run windows
项目构建成功,但是我只看到白屏/黑屏
Android构建中的相同问题
有我的配置
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<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>
<engine name="browser" spec="^5.0.4" />
<engine name="windows" spec="^6.0.1" />
<engine name="android" spec="^7.1.4" />
</widget>
问题出在哪里?没有错误,没有调试信息
答案 0 :(得分:1)
如果控制台中没有错误,则可能不是像这样删除config.xml
文件中的启动画面
<preference name="SplashScreenDelay" value="10000" />
或者在deviceReady
事件之后,您可以使用cordova-splash plugin自己进行操作。
答案 1 :(得分:0)
尝试以下方法之一:
cordova.js
标签,并将以下代码恰好放在</body>
标签之前(就在关闭body标签之前):<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
app.initialize();
</script>
engine
规范。