第一步,安装axios
npm install axios
第二步,main.js引用
import axios from 'axios'
第三步,axios方法调用
axios({ method: "post", url: '接口链接', headers: { 'Content-Type': 'application/json;charset=UTF-8' }, data: { title: this.name, pageNumber: 1 } }).then(res => { console.log(res) }).catch(err => { console.log(err) })
第四步,接口服务器开启跨域
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
uniapp开发微信小程序提示“启动组件按需注入未通过”解决方法
uniapp如何实现扫码枪自带条码读取功能(附vue.js具体代码)
vue中解决post方法application/x-www-form-urlencoded格式编码数据
上面是“uniapp开发axios接口调用解决跨域问题(只需4步)”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_16062.html
workflows工作流
在森林中心有一座蛇形的房子ComfyUI工作流
Latent放大comfyui工作流
一个极其美丽细致的女孩ComfyUI工作流
一个破旧的工厂,一个骷髅雕像
一颗柔和的水晶金字塔ComfyUI工作流
爱因斯坦在做实验3d动漫ComfyUI工作流
一个20岁丰满的女孩ComfyUI工作流
一个穿过泥泞雷区的士兵ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!