require() 方法讲解

复制代码
复制代码
require.config({
  paths:{
    "jquery":"jquery.min",
    "underscore":"underscore.min",
    "backbone":"backbone.min"
  }
});
//逐一指定路径
require.config({
  paths:{
    "jquery": "lib/jquery.min",
    "underscore": "lib/underscore.min",
    "backbone": "lib/backbone.min"
  }
})
//直接改变基目录(baseURL)
require.config({
  baseUrl:"js/lib",
  paths:{
    "jquery": "jquery.min",
    "underscore": "underscore.min",
    "backbone": "backbone.min"
  }
})
//直接指定网址
 require.config({
  path:{
    "jquery":"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min"
  }
})
复制代码

http://www.ruanyifeng.com/blog/2012/11/require_js.html

写的很好

复制代码

 

posted on   含蓄的龅牙妹  阅读(2240)  评论(0编辑  收藏  举报

点击右上角即可分享
微信分享提示