天波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.

main.js 2.6KB

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