main.js 1.1 KB

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