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"}
        })
    })
}
 

猜你喜欢

转载自blog.csdn.net/qq_41687299/article/details/115423850
今日推荐