main.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store'
  4. import {
  5. dayjs
  6. } from '@/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js'
  7. import VueCompositionAPI from '@vue/composition-api'
  8. Vue.use(VueCompositionAPI)
  9. Vue.prototype.$store = store;
  10. Vue.prototype.$dayjs = dayjs;
  11. Vue.prototype.$toast = msg => {
  12. uni.showToast({
  13. title: msg,
  14. icon: "none"
  15. })
  16. };
  17. Vue.prototype.$navigateTo = (url) => {
  18. if (!uni.getStorageSync('token') && url != '/pages/login/login') {
  19. uni.showToast({
  20. title: '您暂未登录,请先登录~',
  21. icon: "none"
  22. });
  23. url = '/pages/login/login'
  24. setTimeout(() => {
  25. uni.navigateTo({
  26. url: url
  27. })
  28. }, 400)
  29. } else {
  30. uni.navigateTo({
  31. url: url
  32. })
  33. }
  34. }
  35. Vue.prototype.$navigateBack = uni.navigateBack;
  36. import field from './config/field.js'
  37. Vue.prototype.$field = field;
  38. import chat from './uitls/chat.js'
  39. chat.init();
  40. Vue.prototype.$chat = chat;
  41. Vue.config.productionTip = false;
  42. App.mpType = 'app';
  43. const app = new Vue({
  44. store,
  45. ...App
  46. })
  47. app.$mount()