Vue脚手架中的问题:
Refused to execute script from 'http://localhost:8081/src/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
翻译:拒绝执行来自“”的脚本http://localhost:8081/src/main.js',因为它的MIME类型('text/html')是不可执行的,并且启用了严格的MIME类型检查。
基础的脚手架练习 就写了 俩组件 **App.vue main.js index.html **
在index页面引入
<!DOCTYPE html>
<html lang="">
<head>
<meta content="text" charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>log.jpg">
<title>9999999999 :)</title>
</head>
<body>
<!--容器-->
<div id="root">
</div>
<!-- 引入-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="../src/main.js"></script>
</body>
</html>
import Vue from 'vue'
import App from './App.vue'
//这里绑定的是index的容器root
new Vue({
render: h => h(App),
}).$mount('#root')
解决: index.html 17行: 注释掉就没有警告了
vue项目默认首页,里面默认引用了app.vue根组件