js
const pub = { url: '', api: { }, Init: function(op) { // console.log(op) // console.log('进入请求函数') // var _this = this wx.request({ url: op.url + op.api, data: op.data, method: 'POST', success(res) { // console.log(res) if (res.statusCode == '200') { op.cb(res.data) } else { wx.showToast({ title: '重新请求数据', icon: 'none', duration: 1000 }) } }, fail(res) { wx.showToast({ title: '数据异常', icon: 'none', duration: 1000, }) } }) },}module.exports = { pub: pub}复制代码
Quote
var util = require('../../utils/util.js')var _url = util.pub.urlvar _api = util.pub.apivar _init = util.pub.Init复制代码