uniapp怎么连接后端 |
您所在的位置:网站首页 › uniapp请求后端接口数据 › uniapp怎么连接后端 |
设置表头,将发送的数据改为form-data类型 export default function request(options) { return new Promise((resolve, reject) => { let base_url = "http://w57ubd.natappfree.cc/api/" uni.request({ url: base_url + options.url, //服务器接口地址 method: options.method, //请求方法 data: options.data, success: resolve, //接口调用成功回调函数 fail: reject ,//接口调用失败回调函数 header:{ "Content-Type": "application/x-www-form-urlencoded"} }) }) } |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |