index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import Vue from 'vue';
  2. import '@/styles/font/font.css';
  3. import ElementUI from 'element-ui';
  4. import 'element-ui/lib/theme-chalk/index.css';
  5. import '@/icons';
  6. import '@/utils/mathjax'; // 必须在引入mathjax前引入mathjax的配置文件
  7. import 'mathjax/es5/tex-mml-chtml';
  8. import VueSignaturePad from 'vue-signature-pad';
  9. import BookEep from './BookEep.vue';
  10. const components = [BookEep];
  11. Vue.use(ElementUI, {
  12. size: 'small',
  13. });
  14. Vue.use(VueSignaturePad);
  15. // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
  16. const install = (VueInstance) => {
  17. if (install.installed) return;
  18. install.installed = true;
  19. components.forEach((component) => {
  20. VueInstance.component(component.name || 'BookEep', component);
  21. });
  22. };
  23. // 判断是否是直接引入文件,如果是,就不用调用 Vue.use()
  24. if (typeof window !== 'undefined' && window.Vue) {
  25. install(window.Vue);
  26. }
  27. // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
  28. export default {
  29. install,
  30. };
  31. // 用户可以通过按需引入的方式来使用组件
  32. export { BookEep };