main.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store' // store
  4. import plugins from './plugins' // plugins
  5. import './permission' // permission
  6. // import uView from 'uview-ui'
  7. import uView from '@/uni_modules/uview-ui'
  8. import $ from '@/pages/common/fun.js'
  9. // 在main.js中注册全局组件
  10. import isLodingModel from './components/loading/loading.vue'
  11. Vue.component('isLodingModel', isLodingModel)
  12. // import navInfo from "@/pagesA/components/my-nav/nav.vue"
  13. // Vue.component('navInfo', navInfo)
  14. Vue.use(uView)
  15. Vue.use(plugins)
  16. Vue.config.productionTip = false
  17. Vue.prototype.$store = store
  18. Vue.prototype.$ = $
  19. Vue.prototype.$screenHeight = uni.getSystemInfoSync().windowHeight
  20. App.mpType = 'app'
  21. const app = new Vue({
  22. ...App
  23. })
  24. app.$mount()
  25. // #ifdef H5
  26. Vue.mixin({
  27. mounted() {
  28. if (this.isWeiXinBrowser() && !this.isCustomNav()) {
  29. this.navTitle()
  30. }
  31. },
  32. methods: {
  33. isWeiXinBrowser() {
  34. let ua = navigator.userAgent.toLowerCase()
  35. return ua.indexOf('micromessenger') != -1
  36. },
  37. isCustomNav() {
  38. return this.$mp && this.$mp.appOptions && this.$mp.appOptions.window && this.$mp.appOptions.window.navigationStyle === 'custom';
  39. },
  40. navTitle() {
  41. this.$nextTick(() => {
  42. let navTitleDom = document.getElementsByTagName('uni-page-head')
  43. if (navTitleDom.length) {
  44. navTitleDom[0].style.display = 'none'
  45. if (typeof wx !== 'undefined' && wx.hideNavigationBarLoading) {
  46. wx.hideNavigationBarLoading()
  47. }
  48. }
  49. })
  50. }
  51. }
  52. })
  53. // #endif