main.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. import './uni.promisify.adaptor'
  5. import store from './store'
  6. import uView from "uview-ui";
  7. import amap from './common/amap-wx.js';
  8. import url from "./common/url.js"
  9. Vue.use(uView);
  10. Vue.prototype.$store = store
  11. Vue.prototype.$islogin = function() {
  12. if (!uni.getStorageSync("token")) {
  13. uni.showToast({
  14. icon: "none",
  15. title: "请登录"
  16. })
  17. return true
  18. } else {
  19. return false
  20. }
  21. }
  22. Vue.prototype.$amapPlugin = new amap.AMapWX({
  23. key: '537ed0efe961d9a3b90d9a2d2f775e1f'
  24. });
  25. Vue.prototype.$url = url
  26. Vue.config.productionTip = false
  27. App.mpType = 'app'
  28. const app = new Vue({
  29. store,
  30. ...App
  31. })
  32. // #ifdef MP-WEIXIN
  33. import WebIM from "./common/wss.js"
  34. Vue.use(WebIM, app)
  35. // #endif
  36. // http拦截器,此为需要加入的内容,如果不是写在common目录,请自行修改引入路径
  37. import httpInterceptor from '@/common/http.interceptor.js'
  38. // 这里需要写在最后,是为了等Vue创建对象完成,引入"app"对象(也即页面的"this"实例)
  39. Vue.use(httpInterceptor, app)
  40. app.$mount()
  41. // #endif
  42. // #ifdef VUE3
  43. import { createSSRApp } from 'vue'
  44. export function createApp() {
  45. const app = createSSRApp(App)
  46. return {
  47. app
  48. }
  49. }
  50. // #endif