• 微信小程序promise封装(2)

    2019-01-16 浏览:4509
    封装 // 封装请求 Object.defineProperty(exports, "__esModule", { value: !0 }), exports.request = void 0; var e = function(e) { return e && e.__esModule ? e : { default: e }; }(require("./es6-promise.min")), t = exports.request = function() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "GET"; return function(n, r) { ... 展开全文
  • 微信小程序promise封装(1)

    2018-09-03 浏览:8026
    创建promose.js文件 import Promise from './es6-promise.min'; export const request = (method = 'GET') => (url, data) => { return new Promise((resolve, reject) => { wx.request({ url, data, method, header: { 'Content-Type': 'application/json' }, success: function (res) { resolve(res.data) }, fail: function (err) { ... 展开全文