5种JavaScript脚本加载的方式(2)

<script src="https://www.jb51.net/article/LAB.js"></script> <script type="text/javaScript">     $LAB      .script("script1.js").wait()      .script("script2-a.js")      .script("script2-b.js")      .wait(function(){        initScript1();        initScript2();      })      .script("script3.js")      .wait(function(){        initScript3();      }); </script>

方式五:requireJS

<script src="https://www.jb51.net/require.js"></script> <script type="text/javaScript">     require([       "script1.js",       "script2-a.js",       "script2-b.js",       "script3.js"      ],      function(){       initScript1();       initScript2();       initScript3();      }     ); </script>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwdjyj.html