问题描述:

I'm using Dojo 1.10 and i try to solve all the problemas with undescore files (_blabla). related here: https://code.google.com/p/android/issues/detail?id=5343

building/minimizing dojo for specific webkit:

http://dojotoolkig.org/reference-guide/1.10/build/webkit-mobile.html#build-webkit-mobile and everything works fine excepts Carousel and Accordion, this elements loads fine on local webserver.

I try to debug with weinre and this "classes" Carousel, Accordion doesn't exists (object dojox.mobile doesn't contain this)

Anyone can provide me with a glimmers of hope

iOS and webbrowsers works fine, I'm using Cordova 4.0 (only JS, CSS, HTML)

Tested on Physical and virtual devices

网友答案:

Should not have the _ problems, All the widgets you need, including Carousel are compiled into the layer files..(Carousel is inside of mobile-ui-layer.js) In your www folder there should be either mobile-ui-layer.js and core-web-layer.js files in either the layers or dojo subdirectory.

and your wlCommonInit has to be referencing these files depending on where they are in your project:

function wlCommonInit() {
    require([ "layers/core-web-layer", "layers/mobile-ui-layer" ], dojoInit);
}

Edit, sorry just noticed that you are saying you are using straight cordova and not worklight.

They easiest say to deal with this is to use the dojo build, to condense the dojo files into a layer file.

  1. Download -src.zip package from dojo website
  2. extract new dojo
  3. navigate to /js/dojo-src/util/buildscripts/profiles
  4. use one of the existing profiles as template. insert something like i have below as a layer.
  5. run ./build.sh -p ./profiles/.profile.js
  6. Add Layer file to project and reference it.

Sample Mobile Layer:

layers: {
        "dojo/mobile-ui-layer":{
            include: ["dojox/mobile",
            "dojox/mobile/_base",
            "dojox/mobile/_ComboBoxMenu",
            "dojox/mobile/_ContentPaneMixin",
            "dojox/mobile/_css3",
            "dojox/mobile/_DataListMixin",
            "dojox/mobile/_DataMixin",
            "dojox/mobile/_DatePickerMixin",
            "dojox/mobile/_EditableIconMixin",
            "dojox/mobile/_EditableListMixin",
            "dojox/mobile/_ExecScriptMixin",
            "dojox/mobile/_IconItemPane",
            "dojox/mobile/_ItemBase",
            "dojox/mobile/_ListTouchMixin",
            "dojox/mobile/_maskUtils",
            "dojox/mobile/_PickerBase",
            "dojox/mobile/_PickerChooser",
            "dojox/mobile/_ScrollableMixin",
            "dojox/mobile/_StoreListMixin",
            "dojox/mobile/_StoreMixin",
            "dojox/mobile/_TimePickerMixin",
            "dojox/mobile/Accordion",
            "dojox/mobile/Audio",
            "dojox/mobile/Badge",
            "dojox/mobile/bookmarkable",
            "dojox/mobile/Button",
            "dojox/mobile/Carousel",
            "dojox/mobile/CarouselItem",
            "dojox/mobile/CheckBox",
            "dojox/mobile/ComboBox", // experimental    
            "dojox/mobile/common",
            "dojox/mobile/compat",
            "dojox/mobile/Container",
            "dojox/mobile/ContentPane",
            "dojox/mobile/DataCarousel",
            "dojox/mobile/DatePicker",
            "dojox/mobile/EdgeToEdgeCategory",
            "dojox/mobile/EdgeToEdgeDataList",
            "dojox/mobile/EdgeToEdgeList",
            "dojox/mobile/EdgeToEdgeStoreList",
            "dojox/mobile/ExpandingTextArea",
            "dojox/mobile/FilteredListMixin",
            "dojox/mobile/FixedSplitter",
            "dojox/mobile/FixedSplitterPane",
            "dojox/mobile/FormLayout",
            "dojox/mobile/GridLayout",
            "dojox/mobile/Heading",
            "dojox/mobile/i18n",
            "dojox/mobile/Icon",
            "dojox/mobile/IconContainer",
            "dojox/mobile/IconItem",
            "dojox/mobile/IconMenu",
            "dojox/mobile/IconMenuItem",
            "dojox/mobile/iconUtils",
            "dojox/mobile/lazyLoadUtils",
            "dojox/mobile/ListItem",
            "dojox/mobile/LongListMixin",
            "dojox/mobile/Opener",
            "dojox/mobile/Overlay",
            "dojox/mobile/PageIndicator",
            "dojox/mobile/pageTurningUtils",
            "dojox/mobile/Pane",
            //"dojox/mobile/parser",
            "dojox/mobile/ProgressBar",
            "dojox/mobile/ProgressIndicator",
            "dojox/mobile/RadioButton",
            "dojox/mobile/Rating",
            "dojox/mobile/RoundRect",
            "dojox/mobile/RoundRectCategory",
            "dojox/mobile/RoundRectDataList",
            "dojox/mobile/RoundRectList",
            "dojox/mobile/RoundRectStoreList",
            "dojox/mobile/ScreenSizeAware", // experimental
            "dojox/mobile/scrollable",
            "dojox/mobile/ScrollablePane",
            "dojox/mobile/ScrollableView",
            "dojox/mobile/SearchBox",
            "dojox/mobile/SimpleDialog",
            "dojox/mobile/Slider",
            "dojox/mobile/sniff",
            "dojox/mobile/SpinWheel",
            "dojox/mobile/SpinWheelDatePicker",
            "dojox/mobile/SpinWheelSlot",
            "dojox/mobile/SpinWheelTimePicker",
            "dojox/mobile/StoreCarousel",
            "dojox/mobile/SwapView",
            "dojox/mobile/Switch",
            "dojox/mobile/TabBar",
            "dojox/mobile/TabBarButton",
            "dojox/mobile/TextArea",
            "dojox/mobile/TextBox",
            "dojox/mobile/TimePicker",
            "dojox/mobile/ToggleButton",
            "dojox/mobile/ToolBarButton",
            "dojox/mobile/Tooltip",
            "dojox/mobile/transition",
            "dojox/mobile/TransitionEvent",
            "dojox/mobile/TreeView", // experimental
            "dojox/mobile/uacss",
            "dojox/mobile/ValuePicker",
            "dojox/mobile/ValuePickerDatePicker",
            "dojox/mobile/ValuePickerSlot",
            "dojox/mobile/ValuePickerTimePicker",
            "dojox/mobile/Video",
            "dojox/mobile/View",
            "dojox/mobile/ViewController",
            "dojox/mobile/viewRegistry",
            "dojox/mobile/dh/ContentTypeMap",
            "dojox/mobile/dh/DataHandler",
            "dojox/mobile/dh/HtmlContentHandler",
            "dojox/mobile/dh/HtmlScriptContentHandler",
            "dojox/mobile/dh/JsonContentHandler",
            "dojox/mobile/dh/PatternFileTypeMap",
            "dojox/mobile/dh/StringDataSource",
            "dojox/mobile/dh/SuffixFileTypeMap",
            "dojox/mobile/dh/UrlDataSource"],
            exclude: [
                "dojox/mobile/bidi/_ComboBoxMenu",
                "dojox/mobile/bidi/_ItemBase",
                "dojox/mobile/bidi/_StoreListMixin",
                "dojox/mobile/bidi/Accordion",
                "dojox/mobile/bidi/Badge",
                "dojox/mobile/bidi/Button",
                "dojox/mobile/bidi/Carousel",
                "dojox/mobile/bidi/CarouselItem",
                "dojox/mobile/bidi/common",
                "dojox/mobile/bidi/Heading",
                "dojox/mobile/bidi/IconItem",
                "dojox/mobile/bidi/IconMenu",
                "dojox/mobile/bidi/ListItem",
                "dojox/mobile/bidi/RoundRectCategory",
                "dojox/mobile/bidi/SpinWheelSlot",
                "dojox/mobile/bidi/Switch",
                "dojox/mobile/bidi/TabBar",
                "dojox/mobile/bidi/TabBarButton",
                "dojox/mobile/bidi/TextBox",
                "dojox/mobile/bidi/ToolBarButton",
                "dojox/mobile/bidi/Tooltip",
                "dojox/mobile/bidi/TreeView",
                "dojox/mobile/bidi/ValuePickerSlot"
            ]
        }
相关阅读:
Top