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 2017-03-28 14:53  含蓄的龅牙妹  阅读(2240)  评论(0编辑  收藏  举报

导航