在main.js中配置以下代码就可以解决
Vue.mixin({
mounted() {
// #ifdef H5
if (this.isWeiXinBrowser() || this.isQQBrowser()) {
this.navTitle()
}
// #endif
},
methods: {
// #ifdef H5
isWeiXinBrowser() {
let ua = navigator.userAgent.toLowerCase()
return ua.indexOf('micromessenger') != -1
},
isQQBrowser() {
var ua = navigator.userAgent.toLowerCase()
if (ua.match(/QQ/i) == "qq") {
return true
} else {
return false
}
},
// #endif
navTitle() {
this.$nextTick(() => {
let navTitleDom = document.getElementsByTagName('uni-page-head')
if (navTitleDom.length) {
navTitleDom[0].style.display = 'none'
}
})
}
}
})