var baseUrl ="https://music.aityp.com/"
function http({url,data,callback}){
wx.request({
url: baseUrl+url,
data: {},
header: {'content-type':'application/json'},
method: 'GET',
dataType: 'json',
responseType: 'text',
success: (res)=>{
callback(res)
}
});
}
module.exports = http;
调用
const http = require('../../util/http.js');
Page({
data: {
},
onLoad: function (options) {
http({
url:"mv/first",
callback:this.handleData
})
},
handleData(res){
console.log(res)
}
})