deming/common/http.api.js

17 lines
604 B
JavaScript
Raw Normal View History

2020-06-15 02:00:14 +00:00
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作更多内容详见uView对拦截器的介绍部分
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
import shop from "./api/shop"
import user from "./api/user"
const install = (Vue, vm) => {
2020-06-15 03:34:33 +00:00
let userApi = user.init(vm)
let shopApi = shop.init(vm)
2020-06-15 02:00:14 +00:00
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
2020-06-15 03:34:33 +00:00
vm.$u.api = {...userApi,...shopApi};
2020-06-15 02:00:14 +00:00
}
export default {
install
}