天波h5前端应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
2.7KB

  1. /*
  2. * @Date: 2022-01-19 10:08:26
  3. * @LastEditors: JinxChen
  4. * @LastEditTime: 2023-10-11 15:36:55
  5. * @FilePath: \TelpoH5FrontendWeb\src\main.js
  6. * @description:
  7. */
  8. import Vue from "vue";
  9. import 'amfe-flexible/index.js';
  10. import App from "./App.vue";
  11. import router from "./router";
  12. import store from "./store";
  13. import '@/assets/css/reset.scss';
  14. import dayjs from 'dayjs';
  15. // ui库按需引入
  16. import 'vant/lib/index.css';
  17. import { replaceAll } from '@/utils';
  18. // 引入echarts
  19. import * as echarts from 'echarts';
  20. import { BaiduStatisticsModel} from '@/config/models';
  21. import {
  22. Button,
  23. Calendar,
  24. Cell,
  25. CellGroup,
  26. Checkbox,
  27. CheckboxGroup,
  28. Col,
  29. DatetimePicker,
  30. Dialog,
  31. Divider,
  32. Empty,
  33. Field,
  34. Form,
  35. Icon,
  36. Image,
  37. Lazyload,
  38. List,
  39. Loading,
  40. NavBar,
  41. NoticeBar,
  42. Notify,
  43. Overlay,
  44. Picker,
  45. Popup,
  46. PullRefresh,
  47. Radio,
  48. RadioGroup,
  49. Row,
  50. Slider,
  51. Swipe,
  52. SwipeCell,
  53. SwipeItem,
  54. Switch,
  55. Tab,
  56. Tabbar,
  57. TabbarItem,
  58. Tabs,
  59. Toast,
  60. ActionSheet,
  61. Progress,
  62. DropdownMenu,
  63. DropdownItem,
  64. TreeSelect,
  65. } from 'vant'; //按需加载vant组件
  66. Vue
  67. .use(Button)
  68. .use(Calendar)
  69. .use(Checkbox)
  70. .use(CheckboxGroup)
  71. .use(Cell)
  72. .use(CellGroup)
  73. .use(Col)
  74. .use(DatetimePicker)
  75. .use(Dialog)
  76. .use(Divider)
  77. .use(Empty)
  78. .use(Icon)
  79. .use(Image)
  80. .use(Form)
  81. .use(Field)
  82. .use(Lazyload)
  83. .use(List)
  84. .use(Loading)
  85. .use(NavBar)
  86. .use(NoticeBar)
  87. .use(Notify)
  88. .use(Overlay)
  89. .use(Picker)
  90. .use(Popup)
  91. .use(PullRefresh)
  92. .use(Radio)
  93. .use(RadioGroup)
  94. .use(Row)
  95. .use(Slider)
  96. .use(Swipe)
  97. .use(SwipeCell)
  98. .use(SwipeItem)
  99. .use(Switch)
  100. .use(Tab)
  101. .use(Tabbar)
  102. .use(TabbarItem)
  103. .use(Tabs)
  104. .use(Toast)
  105. .use(ActionSheet)
  106. .use(Progress)
  107. .use(DropdownMenu)
  108. .use(DropdownItem )
  109. .use(TreeSelect)
  110. Vue.config.productionTip = false;
  111. Vue.config.devtools = true;
  112. // 全局配置 loading
  113. Toast.setDefaultOptions('success', {
  114. duration: 1500,
  115. forbidClick: true,
  116. });
  117. Toast.setDefaultOptions('loading', {
  118. duration: 1500,
  119. forbidClick: true,
  120. });
  121. Dialog.setDefaultOptions({
  122. confirmButtonColor: "#3296fa",
  123. showCancelButton: false,
  124. });
  125. Vue.config.productionTip = false;
  126. Vue.prototype.$dayjs = dayjs;
  127. Vue.prototype.$echarts = echarts;
  128. Vue.prototype.$bus = new Vue();
  129. Vue.prototype.$replaceAll = replaceAll;
  130. router.afterEach((to, from, next) => {
  131. // 创建百度统计js
  132. setTimeout(()=>{
  133. var _hmt = _hmt || [];
  134. (function() {
  135. var hm = document.createElement("script");
  136. hm.src = BaiduStatisticsModel[ process.env.NODE_ENV ];
  137. var s = document.getElementsByTagName("script")[0];
  138. s.parentNode.insertBefore(hm, s);
  139. })();
  140. },0);
  141. });
  142. new Vue({
  143. router,
  144. store,
  145. render: (h) => h(App),
  146. }).$mount("#app");