main.js
- require.config({
- urlArgs: "debug=" + (new Date()).getTime(),
- paths: {
- 'jquery': "../jquery/3.3.1/jquery.min",
- 'bootstrap': '../bootstrap/5.2.3/js/bootstrap.bundle.min'
- },
- shim:{
- 'bootstrap':{
- exports: 'bootstrap'
- }
- }
- });
- //动态加载模块
- require(['index'], function(module){
- console.log(module);
- }, function (e) {
- console.error(e);
- });
复制代码 index.js
- define(['jquery','bootstrap'], function($,bootstrap){
- $('#carousel').carousel({interval: 1000});
- return true;
- });
复制代码
|
|