微信小程序 请求封装
项目根目录下新建http
文件夹
- 新建
http\api.js
import {
wxRequest, get, post, getWxLoginCode } from './request.js'
const apiURL = "http://www.xxx.com/api";
export const getUserInfo = p => get(`${
apiURL}/v1/user`, p);
- 新建
http\request.js
const wxRequest = (url, params, method) => {
wx.showLoading({
title: "加载中",
});
return