require.config({
baseUrl: ‘./js’,
paths: {
// 第三方模块
‘jquery’: ‘lib/jquery-3.3.1’,
‘text’: “lib/text”,
‘css’: ‘lib/css’,
‘css’: ‘lib/css’,
‘bootStrap’: ‘lib/bootstrap-3.3.7/bootstrap’,
‘bootstrap_css’: “lib/bootstrap-3.3.7/bootstrap”,
// 自定义模块
‘person’: ‘person’,
// 自定义html
‘personPage’: ‘…/pages/person.html’,
‘tabNav’: ‘…/pages/tabNav.html’,
// 自定义CSS
‘indexStyle’: ‘…/css/index’
},
shim: { // 配置第三方不支持AMD 格式的库或者插件
'bootStrap': {
deps: ['jquery'], // 注入bootstap 需要依赖的模块
exports: 'bootStrap',
}
},
})
require([‘jquery’, ‘person’, ‘text!personPage’, ‘text!tabNav’, ‘bootStrap’,‘css!indexStyle’], function ($, person, template1, template2) {
console.log(template2)
$('#main').html(template2)
})