jsonp与代理的使用方式

导入jsonp:
在这里插入图片描述
使用jsonp:
在这里插入图片描述
本地的json数据获取
1 把数据json拷贝到public目录
2 发起ajax请求
this.$http.get(’/js/data.json’)
.then(res=>{})
.catch(err=>{})

webpack代理方式

新建一个vue.config.js
在这里插入图片描述

发布了16 篇原创文章 · 获赞 9 · 访问量 275

猜你喜欢

转载自blog.csdn.net/webblock/article/details/104978635