Uncaught ReferenceError: Vue is not defined :项目突然报错
问题描述
这几天项目突然就访问不了,报 Vue is not defined:
既然不是代码问题,初步分析是cdn加载慢或直接访问不了的原因
原因分析:
cdn 访问不了
解决方案:
暴力改法,直接将文件复制到本地引用。当然也可以换一个cdn或者自建cdn
```c
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title></title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.2/lib/theme-chalk/index.css">
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js"></script>
<script src="https://unpkg.com/axios@0.18.1/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.16.0/dist/d3.min.js"></script>-->
<!-- 粗暴改法,直接将文件存在本地 -->
<script src="static/vue@2.6.11.js"></script>
<script src="static/moment@2.24.0.js"></script>
<script src="static/axios@0.18.1.js"></script>
<script src="static/d3@5.16.0.js"></script>
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<!-- <script src="https://gw.alipayobjects.com/os/lib/antv/g2/3.5.17/dist/g2.min.js"></script>-->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=tg4QgzwdHGm7QPwSzwEKmKD5OpOvQd7u"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/AreaRestriction/1.2/src/AreaRestriction_min.js"></script>
</body>
</html>