main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import App from './App'
  2. import Vue from 'vue'
  3. import store from './store'
  4. import uvUI from '@/uni_modules/uv-ui-tools'
  5. Vue.use(uvUI);
  6. uni.$uv.setConfig({
  7. // 修改$uv.config对象的属性
  8. config: {
  9. // 修改默认单位为rpx,相当于执行 uni.$uv.config.unit = 'rpx'
  10. unit: 'rpx'
  11. }
  12. })
  13. Vue.prototype.$store = store;
  14. import chat from './uitls/chat.js'
  15. chat.init();
  16. import customerServe from './uitls/customerServe.js'
  17. customerServe.init();
  18. Vue.prototype.$chat = chat;
  19. Vue.prototype.$customerServe = customerServe;
  20. Vue.prototype.$toast = msg => {
  21. uni.showToast({
  22. title: msg,
  23. icon: "none"
  24. })
  25. };
  26. Vue.prototype.$navigateTo = (url) => {
  27. if (!uni.getStorageSync('token') && url != '/pages/login/login') {
  28. url = '/pages/login/login';
  29. }
  30. uni.navigateTo({
  31. url: url
  32. })
  33. }
  34. Vue.prototype.initBadge = () => {
  35. if (uni.getStorageSync('chatBadge')) {
  36. let badge = uni.getStorageSync('chatBadge');
  37. if (badge === '0') {
  38. uni.removeTabBarBadge({
  39. index: 3
  40. })
  41. } else {
  42. uni.setTabBarBadge({
  43. index: 3,
  44. text: badge
  45. })
  46. }
  47. }
  48. }
  49. Vue.config.productionTip = false;
  50. App.mpType = 'app'
  51. const app = new Vue({
  52. ...App
  53. })
  54. app.$mount()