0

シンプルなワークライト アプリケーションを作成しようとしていますが、新しいアプリケーションを作成しようとすると、次のことMemoryが発生します。 Uncaught TypeError: Cannot read property 'style' of null at mobile-ui-layer.js:378

Memory オブジェクトの作成とスタイリングの関係がわからないので、これはかなり奇妙に思えます。

Chrome でデバッグすると、行の直後に表示されvar testStore = new Memory({data:storeData})ます。

require (
                    ["dojo", 
                    "dojo/parser", 
                    "dojo/_base/xhr",
                    "dijit/form/ComboBox",  
                    "dojo/store/JsonRest", 
                    "dojo/ready",
                    "dojox/mobile/EdgeToEdgeStoreList",
                    "dojox/mobile",
                    "dojox/mobile/parser",
                    "dojox/io/xhrWindowNamePlugin",
                    "dojox/io/windowName", 
                    "dojox/io/xhrPlugins", 
                    "dojo/dom-style", 
                    "dojo/dom", 
                    "dojo/dom-class", 
                    "dojo/_base/Deferred",
                    "dojo/store/Memory"], function(JsonRestStore, EdgeToEdgeStoreList, xhrPlugins, Memory) {

            storeData = [
                                 { "label": "Wi-Fi", "icon": "images/i-icon-3.png", "rightText": "Off", "moveTo": "bar" },
                                 { "label": "VPN", "icon": "images/i-icon-4.png", "rightText": "VPN", "moveTo": "bar" }
                             ];
                    var testStore = new Memory({data:storeData});
                    var testList = new dojox.mobile.EdgeToEdgeStoreList({store:testStore}, "testList");
                    storeList.startup();
            });

参考までに:worklight 5.0.5です

4

1 に答える 1

2

主な問題は、require配列内のすべての依存関係が関数内のパラメーター名と一致する必要があることです。例えば

require(['dep1','dep2','dep3'],function(dep1,dep2,dep3){});

少し外挿します

require(
["dojo",
  "dojo/parser",
  "dojo/_base/xhr",
  "dijit/form/ComboBox",
  "dojo/store/JsonRest",
  "dojo/ready",
  "dojox/mobile/EdgeToEdgeStoreList",
  "dojox/mobile",
  "dojox/mobile/parser",
  "dojox/io/xhrWindowNamePlugin",
  "dojox/io/windowName",
  "dojox/io/xhrPlugins",
  "dojo/dom-style",
  "dojo/dom",
  "dojo/dom-class",
  "dojo/_base/Deferred",
  "dojo/store/Memory"], function (dojo,parser,xhr,ComboBox,JsonRest,ready,EdgeToEdgetStoreList,mobile,parser,xhrPlugin,windowname,xhrPlugins,domStyle,dom,domClass,Deferred,Memory) {

  storeData = [{
    "label": "Wi-Fi",
    "icon": "images/i-icon-3.png",
    "rightText": "Off",
    "moveTo": "bar"
  }, {
    "label": "VPN",
    "icon": "images/i-icon-4.png",
    "rightText": "VPN",
    "moveTo": "bar"
  }];
    console.log(Memory);
  var testStore = new Memory({

    data: storeData
  });  
    var storeList = new dojox.mobile.EdgeToEdgeStoreList({
    store: testStore
  }, "testList");
  storeList.startup();

});

コードスニペットで起こっていたのは、パラメーターMemoryが実際にはその名前が示すものとは異なるクラスであったということでした。依存関係の配列の順序に基づいて、それはでしたEdgeToEdgeStoreList

于 2013-01-15T13:18:04.533 に答える