main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Vue from "vue";
  2. import App from "./App";
  3. import * as filters from "./utils/filters.js"; // global filter
  4. import uView from "uview-ui";
  5. import empty from "./components/empty";
  6. import store from "./store";
  7. // #ifdef H5
  8. // 在h5页面手动挂载 h5唤醒app插件
  9. import airBtn from "@/components/m-airbtn/index.vue";
  10. let btn = Vue.component("airBtn", airBtn); //全局注册
  11. document.body.appendChild(new btn().$mount().$el);
  12. // #endif
  13. Object.keys(filters).forEach((key) => {
  14. Vue.filter(key, filters[key]);
  15. });
  16. const msg = (title, duration = 1500, mask = false, icon = "none") => {
  17. //统一提示方便全局修改
  18. if (Boolean(title) === false) {
  19. return;
  20. }
  21. uni.showToast({
  22. title,
  23. duration,
  24. mask,
  25. icon,
  26. });
  27. };
  28. // 引入vuex
  29. Vue.prototype.$store = store;
  30. // 全局引入空组件
  31. Vue.component("empty", empty);
  32. Vue.use(uView);
  33. Vue.config.productionTip = false;
  34. // 主题色
  35. Vue.prototype.$mainColor = "#ff3c2a";
  36. // 高亮主题色
  37. Vue.prototype.$lightColor = "#ff6b35";
  38. // 可直接 this.$api调用
  39. Vue.prototype.$api = { msg };
  40. App.mpType = "app";
  41. const app = new Vue({
  42. ...App,
  43. });
  44. app.$mount();