0

dojox.forms.Horizo​​ntalRangeSliderdojox.forms.VerticalRangeSlider都在/dojox/forms/RangeSlider.js中定义。我需要做什么来 dojoConfig 而不是使用 require 语句,以便仅在必要时加载包?

我正在使用 Dojo 1.8

<div style="width: 300px;"
    data-dojo-id="myRangeInputSlider" 
    data-dojo-type="dojox/form/HorizontalRangeSlider" 
    data-dojo-props="value:[2000,10000], maximum:1000000, discreteValues:20, showButtons:false">

似乎Dojo Ticket #16301与同一问题有关 - 有没有办法解决这个问题?

4

1 回答 1

0

如上所述,将模块定义myapp/dijit/form/HorizontalRangeSlider.js为:

define([
    "dojo/_base/declare", 
    "dojo/_base/lang",
    "dojo/on",
    "dojox/form/RangeSlider"
], function(declare, lang, on, slider){
    var hrs = dojox.form.HorizontalRangeSlider;
    var rs = declare( "dojox.form.HorizontalRangeSlider", hrs, {
        onChange: function(e) {
            // console.log( "HRS Onchange");
        },

        startup: function() {
            // console.log( "HRS Startup");
     }
    });

    return rs;
});

任何其他关于如何dojoConfig正确使用自动要求的替代想法或建议将不胜感激!

于 2013-07-03T08:33:16.123 回答