requirejs 加载其它js

基本代码:

require.config({
    // baseUrl : '/js/'
    paths: {
        jquery: '/js/jquery-1.11.3.min',
        validate: '/js/public/jquery.validate.min',
        email: '/js/member/emailAutoComplete',
        regist: '/js/member/registValidate',
        login: '/js/member/loginValidate'
    },
    shim: {//这里加载非AMD规范的js
        email: {
            deps: ['jquery'],
            exports: ''
        },
        regist: {
            deps: ['validate'],//指定‘regist’所依赖的js,否则会报错
            exports: ''
        },
        login: {
            deps: ['validate'],
            exports: ''
        }

    }

});

require(['jquery', 'email', 'validate', 'regist', 'login'], function($, validate) {....})

 

posted @ 2015-12-30 14:52  until-u  阅读(644)  评论(0编辑  收藏  举报