loading.js 724 B

123456789101112131415161718192021222324252627
  1. /* eslint-disable no-console */
  2. /* eslint-disable no-param-reassign */
  3. import Vue from 'vue';
  4. const Plugin = {
  5. // eslint-disable-next-line no-unused-vars
  6. install(vue, options) {
  7. // 3. 注入组件
  8. vue.mixin({
  9. created() {
  10. // eslint-disable-next-line no-underscore-dangle
  11. const isRoot = this.constructor === Vue;
  12. // console.log(`rootId:${rootVue_uid}; thisId:${this._uid}`);
  13. // if (rootVue_uid !== 3) {
  14. // console.log(this);
  15. // }
  16. if (isRoot) {
  17. const el = document.getElementById('loading');
  18. if (el) el.style.display = 'none';
  19. }
  20. },
  21. });
  22. },
  23. };
  24. Vue.use(Plugin, { baseUrl: process.env.VUE_APP_AXIOS_BASE_URL });