/addons/ewei_shopv2/static/js/config1.0.js

var version = +new Date();
require.config({
    urlArgs: 'v=' + version,   //RequireJS有缓存的功能,我们不希望它缓存,就可以在require.config设置urlArgs  如 ../addons/ewei_shopv2/static/fonts/iconfont.css?v=2017070719
    baseUrl: '../addons/ewei_shopv2/static/js/app',       //基目录
    paths: {
        'jquery': '../dist/jquery/jquery-1.11.1.min',    //模块 相对baseUrl路径
        'jquery.gcjs': '../dist/jquery/jquery.gcjs',
        'tpl':'../dist/tmodjs',
        'foxui':'../dist/foxui/js/foxui.min',
        'foxui.picker':'../dist/foxui/js/foxui.picker.min',
        'foxui.citydata':'../dist/foxui/js/foxui.citydata.min',
        'foxui.citydatanew':'../dist/foxui/js/foxui.citydatanew.min',
        'foxui.street':'../dist/foxui/js/foxui.street.min',
        'jquery.qrcode':'../dist/jquery/jquery.qrcode.min',
        'ydb':'../dist/Ydb/YdbOnline',
        'swiper':'../dist/swiper/swiper.min',
        'jquery.fly': '../dist/jquery/jquery.fly',
 
    },
    shim: {
        'foxui':{              //shim中的key与paths中定义的名字一样
            deps:['jquery']
        },
        'foxui.picker': {
            exports: "foxui",     //exports 表示输出的对象名
            deps: ['foxui','foxui.citydata']     //deps 为数组,表示其依赖的库
        },
	'jquery.gcjs': {
	                 deps:['jquery']
		},
	'jquery.fly': {
	                 deps:['jquery']
		}
    },
    waitSeconds: 0    //
});

https://www.cnblogs.com/zhourunbest/p/5527557.html

https://www.cnblogs.com/xiaoxiaossrs/p/7283502.html

/addons/ewei_shopv2/static/js/myconfig.js

var version = +new Date();
var myconfig = {
    path: '../addons/ewei_shopv2/static/js/',
    alias: {
        'jquery': 'dist/jquery/jquery-1.11.1.min',
        'jquery.form': 'dist/jquery/jquery.form',
        'jquery.gcjs': 'dist/jquery/jquery.gcjs',
        'jquery.validate': 'dist/jquery/jquery.validate.min',
        'jquery.nestable': 'dist/jquery/nestable/jquery.nestable',
        'jquery.qrcode':'../dist/jquery/jquery.qrcode.min',
        'bootstrap': 'dist/bootstrap/bootstrap.min',
        'bootstrap.suggest': 'dist/bootstrap/bootstrap-suggest.min',
        'bootbox': 'dist/bootbox/bootbox.min',
        'sweet': 'dist/sweetalert/sweetalert.min',
        'select2': 'dist/select2/select2.min',
        'jquery.confirm': 'dist/jquery/confirm/jquery-confirm',
        'jquery.contextMenu': 'dist/jquery/contextMenu/jquery.contextMenu',
        'switchery': 'dist/switchery/switchery',
        'echarts': 'dist/echarts/echarts-all',
        'echarts.min': 'dist/echarts/echarts.min',
        'toast': 'dist/jquery/toastr.min',
        'clipboard': 'dist/clipboard.min',
        'tpl': 'dist/tmodjs',
        'daterangepicker': 'dist/daterangepicker/daterangepicker',
        'datetimepicker': 'dist/datetimepicker/jquery.datetimepicker',
        'ueditor': 'dist/ueditor/ueditor.parse.min',
        'tooltipbox': 'dist/tooltipbox',
 
    },
    map: {
        'js': '.js?v=' + version,
        'css': '.css?v=' + version
    },
    css: {
        'jquery.confirm': 'dist/jquery/confirm/jquery-confirm',
        'sweet': 'dist/sweetalert/sweetalert',
        'select2': 'dist/select2/select2,dist/select2/select2-bootstrap',
        'jquery.nestable': 'dist/jquery/nestable/nestable',
        'jquery.contextMenu': 'dist/jquery/contextMenu/jquery.contextMenu',
        // 'daterangepicker': 'dist/daterangepicker/daterangepicker',
        // 'datetimepicker': 'dist/datetimepicker/jquery.datetimepicker',
        'ueditor': 'dist/ueditor/themes/default/css/ueditor.min',
        'switchery': 'dist/switchery/switchery'
    }
    , preload: ['jquery']
 
};
 
 
 
var myrequire = function (arr, callback) {
    var newarr = [];
    $.each(arr, function () {
        var js = this;
 
        if (myconfig.css[js]) {
            var css = myconfig.css[js].split(',');
            $.each(css, function () {
                if(typeof myrequire.systemVersion !== 'undefined'){
                    if (myrequire.systemVersion === '1.0.0' || myrequire.systemVersion <= '0.8')
                    {
                        newarr.push("css!" + myconfig.path + this + myconfig.map['css']);
                    }
                    else
                    {
                        newarr.push("loadcss!" + myconfig.path + this + myconfig.map['css']);
                    }
                }else{
                    newarr.push("css!" + myconfig.path + this + myconfig.map['css']);
                }
            });
 
 
        }
 
        var jsitem = this;
        if (myconfig.alias[js]) {
            jsitem = myconfig.alias[js];
 
        }
        newarr.push(myconfig.path + jsitem + myconfig.map['js']);
    });
    require(newarr, callback);
}

发表评论

邮箱地址不会被公开。 必填项已用*标注