main.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import "@vci/style";
  2. import App from "./App";
  3. import { adapt } from "../../other/adapt";
  4. import VciLoading from "./components/other/VpLoading/VciLoading.vue";
  5. import { PluginLoading } from "./components/other/VpLoading";
  6. import { PluginNotification } from "./components/other/VpNotification";
  7. import VciNotification from "./components/other/VpNotification/VciNotification.vue";
  8. import FilterIcu from "./filters/filter.icu";
  9. import { PluginPopupQuick } from "./components/popup/PopupQuick";
  10. import MixinData from "./mixins/MixinData";
  11. import DirectiveSilky from "./directives/Silky";
  12. import DirectiveTooltip from "./directives/Tooltip";
  13. import { PluginPopupWindow } from "./components/popup/PopupWindow";
  14. /**
  15. * 初始化Vue
  16. * @param Vue Vue类
  17. * @param option Vue初始化配置
  18. * @param pkg package.json
  19. * @return vm
  20. */
  21. export default function VciInit(Vue, option = {}, pkg = {}) {
  22. // 常用过滤器
  23. Vue.use(FilterIcu);
  24. // 加载业务逻辑
  25. DirectiveSilky(Vue);
  26. // Tooltip
  27. DirectiveTooltip(Vue);
  28. // 弹框
  29. Vue.use(PluginPopupQuick);
  30. // 弹框(窗口)
  31. Vue.use(PluginPopupWindow);
  32. // 加载状态
  33. Vue.use(PluginLoading, { component: VciLoading });
  34. // 通知
  35. Vue.use(PluginNotification, { component: VciNotification });
  36. // 模块数据
  37. Vue.mixin(MixinData);
  38. // 实例化Vue
  39. Vue.config.productionTip = false;
  40. const vm = new Vue({
  41. render: h => h(App),
  42. ...option
  43. }).$mount("#app");
  44. // 屏幕适配
  45. adapt(pkg, vm);
  46. return vm;
  47. }