import { objAssign, randomCode } from "@/plugins/utils";
import globalMixins from "./mixins";
import ViewHeader from "@/components/ViewHeader.vue";
import ViewFooter from "@/components/ViewFooter.vue";
import ArchivesSelect from "../components/base/ArchivesSelect.vue";
import CourseSelect from "../components/base/CourseSelect.vue";
import TeachClazzSelect from "../components/base/TeachClazzSelect.vue";

const components = {
  ViewFooter,
  ViewHeader,
  ArchivesSelect,
  CourseSelect,
  TeachClazzSelect
};

export default {
  install: function(Vue) {
    // 实例方法
    Vue.prototype.$objAssign = objAssign;
    Vue.prototype.$randomCode = randomCode;

    // 注册全局组件
    Object.keys(components).forEach(key => {
      Vue.component(key, components[key]);
    });

    //全局 mixins
    Vue.mixin(globalMixins);
  }
};
