import Vue from 'vue';

const Plugin = {
  install(vue, options) {
    // 3. 注入组件
    vue.mixin({
      created() {
        const isRoot = this.constructor === Vue;
        if (isRoot) {
          const el = document.getElementById('loading');
          if (el) el.style.display = 'none';
        }
      },
    });
  },
};

Vue.use(Plugin, { baseUrl: 'test' });
