main.js
// main.js
// 将fly实例挂在vue原型上,在然而你和组件中通过this使用fly
var Fly=require("flyio/dist/npm/wx")
var fly=new Fly
fly.config.baseURL='http://xx.xx.xx.xx:xxxx/api/v3/' // 配置请求基地址
Vue.prototype.$http=fly // 将fly实例挂在vue原型上
index.vue
<template>
<div>
<div @click="getData()">获取数据</div>
</div>
</template>
<script>
export default {
methods: {
getData () {
let url = 'xxx/xxxx'
let param = {
flag: 1,
access_token: 'xxxxxxxx'
}
this.$http.get(url, param).then((res)=>{
console.log('res', res)
}).catch(err=>{
})
}
}
}
</script>