(一)安装fly插件
npm install flyio --save
(二)在main.js中引入,用作全局变量
let Fly=require("flyio/dist/npm/wx");
let fly=new Fly; //实例化
Vue.prototype.$flyhttp=fly; //挂载在Vue原型上
(三)组件使用
getData(){
this.$flyhttp.get("/login",{}).then((res)=>{
console.log(res);
}).catch(error=>{
console.log(error)
})
}
获取数据