main.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // #ifndef VUE3
  2. import Vue from 'vue'
  3. import App from './App'
  4. Vue.config.productionTip = false
  5. App.mpType = 'app'
  6. const app = new Vue({
  7. ...App
  8. })
  9. app.$mount()
  10. // #endif
  11. // #ifdef VUE3
  12. import { createSSRApp } from 'vue'
  13. import App from './App.vue'
  14. export function createApp() {
  15. const app = createSSRApp(App)
  16. return {
  17. app
  18. }
  19. }
  20. // #endif
  21. Vue.mixin({
  22. mounted() {
  23. if (this.isWeiXinBrowser() || this.isQQBrowser()) {
  24. this.navTitle()
  25. }
  26. },
  27. methods: {
  28. isWeiXinBrowser() {
  29. let ua = navigator.userAgent.toLowerCase()
  30. return ua.indexOf('micromessenger') != -1
  31. },
  32. isQQBrowser() {
  33. var ua = navigator.userAgent.toLowerCase()
  34. if (ua.match(/QQ/i) == "qq") {
  35. return true
  36. } else {
  37. return false
  38. }
  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. }
  46. })
  47. }
  48. }
  49. })