1️⃣ main.js
/*
该文件是整个项目的入口文件
*/
// 引入 vue
import Vue from "vue";
// 引入 App 组件,它是所有组件的父组件
import App from "./App.vue";
// 关闭 Vue 的生产提示
Vue.config.productionTip = false;
// 创建 Vue 实例 - vm
new Vue({
// 模板解析器
render: (h) => h(App),
}).$mount("#app"); // 挂载 #app
1️⃣ index.html
<!DOCTYPE html>
<html lang="">
<head>
<!-- <%...%> 为 EJS 语法 -->
<meta charset="utf-8" />
<!-- 针对 IE 浏览器的一个特殊配置, 含义是让 IE 浏览器以最高的渲染级别渲染页面 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- 开启移动端的理想视口 -->
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- 配置页签图标 -->
<!--
<%= BASE_URL %>
是为了预防路径错误, 指向 public 文件
-->
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<!-- 配置网页标题 -->
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<!-- 当浏览器不支持 JS 时 noscript 中的元素就会被渲染 -->
<noscript>
<strong>
We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't workproperly without JavaScript enabled. Please enable it to continue.
</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected 生成的文件将被自动注入 -->
</body>
</html>