index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import $api from '@/sheep/api';
  2. import $url from '@/sheep/url';
  3. import $router from '@/sheep/router';
  4. import $platform from '@/sheep/platform';
  5. import $helper from '@/sheep/helper';
  6. import zIndex from '@/sheep/config/zIndex.js';
  7. import $store from '@/sheep/store';
  8. import dayjs from 'dayjs';
  9. import relativeTime from 'dayjs/plugin/relativeTime';
  10. import duration from 'dayjs/plugin/duration';
  11. import 'dayjs/locale/zh-cn';
  12. dayjs.locale('zh-cn');
  13. dayjs.extend(relativeTime);
  14. dayjs.extend(duration);
  15. const sheep = {
  16. $api,
  17. $store,
  18. $url,
  19. $router,
  20. $platform,
  21. $helper,
  22. $zIndex: zIndex,
  23. };
  24. // 加载Shopro底层依赖
  25. export async function ShoproInit() {
  26. // 应用初始化
  27. await $store('app').init();
  28. // 平台初始化加载(各平台provider提供不同的加载流程)
  29. $platform.load();
  30. if (process.env.NODE_ENV === 'development') {
  31. ShoproDebug();
  32. }
  33. }
  34. // 开发模式
  35. function ShoproDebug() {
  36. // 开发环境引入vconsole调试
  37. // #ifdef H5
  38. // import("vconsole").then(vconsole => {
  39. // new vconsole.default();
  40. // });
  41. // #endif
  42. // TODO 非繁人:可以打印路由
  43. // 同步前端页面到后端
  44. // console.log(ROUTES)
  45. }
  46. export default sheep;