//核心代碼,需要使用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