vue-cli新建vue项目安装axios后在IE下报错
使用脚手架新建了一个vue项目,可以在IE9+浏览器运行,但是在添加了axios后,在IE下就报错了
首先是安装axios,在命令行执行:
$ npm install axios -s //执行命令,下面是输出结果
+ axios@0.18.0
added 1 package from 1 contributor and audited 32846 packages in 12.611s
found 7 vulnerabilities (1 low, 1 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
在用到axios的页面引入:
import axios from "axios";
然后添加使用的代码:
methods: {
getDatas (){
this.msg = "触发了"
axios.get('http://192.168.80.129:8080/v1/topic/')
.then(function(response) {
console.log(response);
});
}
}
报错图片:

接着又在methods的前面添加了:
mounted() {
this.getDatas ();
},
然后又报错了:

解决方法; 安装 babel-polyfill
$ npm install babel-polyfill --save
npm WARN rollback Rolling back node-pre-gyp@0.10.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'F:\05 poverty alleviation project\poverty\node_modules\fsevents\node_modules'
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + babel-polyfill@6.26.0
added 2 packages from 2 contributors and audited 32852 packages in 12.536s
found 7 vulnerabilities (1 low, 1 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
安装成功后,在main.js 引入

引入后再次运行项目,也就是执行 npm run dev ,然后在IE下查看是否请求数据成功,这里是请求数据成功了的,如下图:

vue-cli新建vue项目安装axios后在IE下报错的更多相关文章
- angular4.0项目build发布后,刷新页面报错404
angular4.0项目执行npm run build后,进入页面正常显示. 但是当刷新页面时,报错404,页面未找到. 出现这个问题的原因,应该是找不到路由地址导致的,然后找到了下面的解决方案. 找 ...
- 安装npm后,nrm ls报错问题
一.nrm : 无法加载文件 E:\nodejs\nrm.ps1,因为在此系统上禁止运行脚本.有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135 ...
- 安装atlas后执行hive命令报错
在集群中安装atlas,在安装atlas的节点上执行hive -e "show databases;" 正常,但是在集群中其他节点上执行hive -e "show dat ...
- 安装Python3后,centos使用yum报错
题记 在之前的文章中我自定义安装了Python3,并且修改了默认的 Python软链,今天想搭建一个 ftp 服务器,使用命令的时候出现了一个错误: 问题 1.使用 yum 安装 ftp工具 yum ...
- eclipse点击包(package)时报错,安装hibernate后点击包报错org/eclipse/jpt/common/utility/exception/ExceptionHandler
错误描述: 当我们点击包名时,出现如下错误提示.An error has occurred. See error log for more details.org/eclipse/jpt/common ...
- Python中安装bs4后,pycharm依然报错ModuleNotFoundError: No module named 'bs4'
学习网络抓取时,第一步出现问题. 执行示例代码 from urllib.request import urlopen from bs4 import BeautifulSoup html = urlo ...
- 静默安装oracle后,启动oem报错,解决方法!
一.手工重建EM Oracle 的gridcontrol 由两部分组成:dbcontrol 和repository. 我们可以对某一部分进行操作,也可以同时进行操作. 这里先看一个因为修改hostna ...
- Windows安装IIS后,启动网站报错:不能在此路径中使用此配置节……
在IIS里启动设置好的网站(ASP.net网站),浏览器报如下错误: 不能在此路径中使用此配置节.如果在父级别上锁定了该节,便会出现这种情况.锁定是默认设置的(overrideModeDefault= ...
- MySql:CentOS7安装mysql后无法启动服务报错,(需要更新yum源)
首先:需要更新你的yum源,保证yum源最新. 1.安装: yum install -y mariadb-server 2.启动maria DB服务: systemctl start mariadb. ...
随机推荐
- 【Linux】MySQL配置
安装环境/工具 Linux( centOS 版) MySQL(MySQL-5.6.28-1.el7.x86_64.rpm-bundle.tar版) MySQL的目录结构 安装已经说过了,这里不再说了 ...
- 2018.09.05 bzoj1010: [HNOI2008]玩具装箱toy(斜率优化dp)
传送门 一道经典的斜率优化dp. 推式子ing... 令f[i]表示装前i个玩具的最优代价. 然后用老套路. 我们只考虑把第j+1" role="presentation" ...
- Android属性动画之ValueAnimator的介绍
之前两篇博客,介绍的是ObjectAnimator作用与某一个控件的某一个属性.但我们的ValueAnimator它本身并不会作用与任何一个属性,它本身也不会提供任何一种动画.它简单的来说,就是一个数 ...
- day02(继承,重写,this,super,final,抽象类)
继承 概述:日常生活中儿女总会继承长辈的遗产,java语言也是.通过继承多种实物之间形成一种关系. 特点: ①一个类只能继承一个父类 ②一个父类可以有多个子类 ③可以多层继承(a类继承b类 C类继 ...
- (KMP 暴力)Corporate Identity -- hdu -- 2328
http://acm.hdu.edu.cn/showproblem.php?pid=2328 Corporate Identity Time Limit: 9000/3000 MS (Java/Oth ...
- 用Java取指定时区的时间 北京时间,纽约时间,班加罗尔时间
/** * 取北京时间 * @return */ public static String getBeijingTime(){ return getFormatedDateString(8); } / ...
- 如何处理App的Application的事件
http://blog.sina.com.cn/s/blog_44fa172f0102vwr2.html 直接上代码,还有条经验就是SetApplicationEventHandler可注册多个事件方 ...
- Microsoft SQL Server 2012 管理 (2): Auditing
-- Demostratin 2A (Using SQL Server Audit) -- Step 1: Use the master database USE master; GO -- Step ...
- XML字符串反序列化为实体
JSON反序列化实体 paydata = StringHelper.Base64ToString(paydata); resInfo = JsonConvert.DeserializeObject&l ...
- 使用ABP框架踩过的坑系列2
ABP中有很多惯例,如果使用得当,可以事半功倍,如果使用不当,也会有很大的麻烦,是否适当其实还是要看Need需求 ASP.NET Boilerplate (ABP) is an open source ...