在cordova中使用dojo app时的一般问题

时间:2015-08-29 11:43:01

标签: ios cordova dojo

我有一个普通的富互联网应用程序,它在每个浏览器中运行良好,使用dojo工具包和一些javascript图表库。

我想把它变成ipad上的混合应用,用于“离线演示问题”。

所以我开始使用cordova,创建了我的应用程序,添加了插件

org.apache.cordova.device org.apache.cordova.console

我把我的html5 / css / js / images放在了cordova项目的“www”文件夹中。

cordova模拟ios --target = iPad-2

什么都没发生......

当我用“hello app”做一个普通的index.html时,它运行正常。 但我没有看到任何错误? 有没有调试控制台? 似乎所有链接都必须是相对的,不能

/根/图像

他们必须

根/图像。

还有一些链接问题吗?

你能给我一个关于科尔多瓦良好开端的提示吗? 我忘了什么吗?

1 个答案:

答案 0 :(得分:0)

我的 www 目录结构如下

    +--css
    +--img
    +--js
        +-dojo
            +--dojo  <dojo library>
    +--plugins

以下是我在Android上为cordova创建的 index.html 文件的摘录。
希望它有所帮助。

<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
        <meta name="format-detection" content="telephone=no" />
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
        <meta name="msapplication-tap-highlight" content="no" />

        <!-- dojo stylesheet will go here -->
        <link rel="stylesheet" href="js/dojo/dojox/mobile/themes/android/android.css" type="text/css">

        <title>ShopToDo Android App v1</title>

        <!-- Cordova Script Tag over here -->
        <script type="text/javascript" src="cordova.js"></script>

        <!-- dojo configuration options -->
        <script>
            dojoConfig = {
                async: true,
                parseOnLoad: false
            };
        </script>
        <!-- dojo bootstrap -->
        <script src="js/dojo/dojo/dojo.js"></script>

        <!-- dojo application code -->
        <!--script type="text/javascript" src="js/shoptodoAndroid6_closure4.js"></script-->
        <script type="text/javascript" src="js/shoptodoAndroid6_closure4.js"></script>


        <script>
            require([
                "dojox/mobile/parser",
                "dojo/ready",
                "dijit/registry",
                "dojo/_base/array",
                "dojo/dom",
                "dojo/dom-style",
                "dojo/dom-class",
                "dojo/dom-construct",
                "dojo/on",
                "dojo/touch",
                "dojox/mobile/compat",
                "dojo/Deferred",
                "dojo/store/Memory",
                "dojox/mobile/Button",
                "dojox/mobile/SimpleDialog",
                "dojox/mobile/ProgressIndicator",
                "dojox/mobile/ListItem",
                "dojox/mobile/RoundRectList",
                "dojox/mobile/View",
                "dojox/mobile/ScrollableView",
                "dojox/mobile/Heading",
                "dojox/mobile/RoundRectCategory",
                "dojox/mobile/RoundRect",
                "dojox/mobile/Switch",
                "dojox/mobile/CheckBox",
                "dojox/mobile/TextArea",
                "dojox/mobile/ExpandingTextArea",
                "dojox/mobile/FormLayout",
                "dojox/mobile/TextBox",
                "dojox/mobile/RadioButton",
                "dojox/mobile/Opener",
                "dojox/mobile/Tooltip",
                "dojox/mobile/TabBar",
                "dojox/mobile/TabBarButton",
                "dojox/mobile/ToolBarButton",
                "dojox/mobile/SpinWheelDatePicker",
                "dojox/mobile/SpinWheel",
                "dojox/mobile/SpinWheelSlot"
            ], function (parser, ready, registry, array, dom, domStyle, domClass,domConstruct, on, touch, compat, Deferred,
                         memory, button, dialog, progressIndicator, ListItem, RoundRectList ) {

.......

}