script error on require “dijit/form/Select”

2019-08-28 13:27发布

问题:

This code

require([ "dojo","dojo/request/script", "dojo/parser", "dojox/mobile", "dojox/mobile/compat", "dojox/mobile/deviceTheme",
              "dojox/mobile/ScrollableView",
              "dojox/mobile/ScreenSizeAware",
              "dojox/mobile/FixedSplitter",
              "dojox/mobile/ContentPane",


              "dijit/form/Select"
              ],

              function(dojo) {

generate a script error on adding Select. Why? I try this but don't works!

Error: multipleDefine


...on(h){return"[object Array]"==l.call(h)},g=function(h,a){if(h)for(var c=0;c<h.le...

dojo.js (line 2)
Error: scriptError

回答1:

This works for me in WL6 with the default dojo 1.9 library:

function dojoInit() {
require([ "dojo", "dojo/ready", "dojo/parser", "dojox/mobile", "dojo/dom", "dijit/registry", "dojox/mobile/ScrollableView",
        "dijit/form/Select" ], function(dojo, ready) {
    ready(function() {

        new dijit.form.Select({
            name : "select2",
            options : [ {label : "TN",value : "Tennessee"}, 
                        {label : "VA",value : "Virginia",selected : true}, 
                        {llabel : "WA",value : "Washington"}, 
                        {label : "FL",value : "Florida"}, 
                        {label : "CA",value : "California"} ]
        }).placeAt(dojo.byId(view0));
    });
});
}

There is no error, though the widget display seems messed up in the app. (it works, but doesn't look right) Maybe it needs some css



回答2:

It usually means that you have a different version of dijit/form/Select defined somewhere and their clashing