utils下建立http 内容如下
function createFly() {
if (mpvuePlatform === ‘wx’) {
const Fly = require(‘flyio/dist/npm/wx’)
return new Fly()
} else {
return null
}
}
function get(url, params = {}) {
const fly = createFly()
if (fly) {
return new Promise((resolve, reject) => {
fly.get(url, params).then(response => {
console.log(response)
resolve(response)
}).catch(err => {
console.log(err)
handleError(err)
reject(err)
})
})
}
}
export {
get
}
index页面请求