代码
html
<html><head><meta charset="UTF-8" /><!-- import Vue before Element --><script src="./js/vue@2.6.14.min.js"></script><!-- import JavaScript --><script src="./js/https.js"></script></head><body><div id="app"></div></body><script>console.log('页面脚本');new Vue({el: "#app",created() {console.log('vue');}})</script></html>
http.js
console.log("http.js 脚本");document.onreadystatechange = () => {console.log("readyStateChange 事件");};window.onload = () => {console.log("window.load 事件");};(function () {var script = document.createElement("script");script.type = "text/javascript";script.src = "./js/hello.js";var html = document.querySelector("head");html.appendChild(script);})();
hello.js
console.log("hello.js 脚本");