//核心代码,需要使用vue.use全局注册,只需参照博主的封装axios
// import {apiServer} from ‘./../../common.js‘ class http { static request(url, params = {}, method = "POST", contentType = "application/x-www-form-urlencoded") { return new Promise((resolve, reject) => { uni.request({ url, //仅为示例,并非真实接口地址。 data: params, header: { ‘Content-Type‘: contentType }, method, success: (res) => { resolve(res.data.data); } }); }) } } export default http
原文地址:https://www.cnblogs.com/uimeigui/p/12146405.html
时间: 2024-10-05 05:20:38