index.js 376 B

1234567891011121314151617181920
  1. // 导入所有接口
  2. import api from './api'
  3. const install = Vue => {
  4. if (install.installed)
  5. return;
  6. install.installed = true;
  7. Object.defineProperties(Vue.prototype, {
  8. // 注意,此处挂载在 Vue 原型的 $api 对象上
  9. $api: {
  10. get() {
  11. return api
  12. }
  13. }
  14. })
  15. }
  16. export default install