vue项目中封装axios

首先,安装axios

npm install axios // 安装

然后,单独写个文件配置axios

然后配置请求时的方法

最后,页面中使用的时候直接 引入方法

就可以在对应页面获取到后台数据了。

猜你喜欢

转载自www.cnblogs.com/shemingxin/p/12473225.html