require.js & jQuery & jQueryUI & datepicker &jquery.ui.datepicker-zh-CN

作者:

在

require.config({
    paths: {
        "jqueryui": '../../../lib/jquery-ui',
        "jquery": "../../../lib/jquery/jquery-1.9.1"
    },
    "shim": {
        "jqueryui/jquery-ui-1.10.3.custom.min": ["jquery"],
        "jqueryui/i18n/jquery.ui.datepicker-zh-CN": ["jqueryui/jquery-ui-1.10.3.custom.min"]
    }
});

require(['jquery', 'jqueryui/jquery-ui-1.10.3.custom.min', 'jqueryui/i18n/jquery.ui.datepicker-zh-CN'], function ($) {
    $(function () {
        $("#datepicker").datepicker({
            changeMonth: true,
            changeYear: true,
            showOn: "button",
            buttonImage: "/css/jquery-ui-themes/base/images/calendar.gif",
            buttonImageOnly: true

        });
    });

})

代码的关键点:在shim中定义依赖关系,跑起!

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

评论

发表回复