0

我正在使用 requirejs 加载 jquery.selectBoxIt。它使用 jQueryUI Widget factory,这就是为什么我只将 jQueryUI 官方网站上的 widget factory 加载到我的项目中。

当项目加载 config.js 时,selectBoxIt 运行没有问题。但是当我用 r.js 构建项目时,我得到了错误$.widget is not defined

请帮助我,请修复它。

PS。我已经阅读了一些谷歌搜索结果,但没有任何帮助。

配置.js

require.config({
    paths: {
        'jquery': 'assets/libs/jquery/2.2.0/jscript/jquery.min',
        'jquery.migrate': 'assets/libs/jquery/plugins/migrate/1.2.1/jscript/migrate.min',
        'jquery.ui': 'assets/libs/jquery.ui/1.12.0/jscript/jquery-ui',
        'jquery.selectboxit': 'assets/libs/jquery/plugins/selectboxit/3.8.1/jscript/selectBoxIt',
    },
    shim: {
        'jquery.migrate': {

            deps: ['jquery'],
            exports: 'jQuery',
        },
        'jquery.selectboxit': {

            deps: ['jquery.migrate', 'jquery.ui'],
        },
    },
});

模块.js

define([
    'jquery.selectboxit',
], function (SelectBoxIt) {
    ...
});

行中的 selectBoxIt 代码中出现错误

$.widget("selectBox.selectBoxIt", {
4

0 回答 0