uniapp js 全局微信浏览器不显示导航,直接上代码。
如下:app.vue文件中
onLoad() {
if (this.is_weixin()) {
}
},
onShow: function() {
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
},
methods: {
is_weixin() {
let ua = window.navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {//判断微信
let style = document.createElement('style');
style.type = 'text/css';
style.innerHTML="uni-page-head,.uni-page-head{display:none;}";
document.getElementsByTagName('head').item(0).appendChild(style);
}
}
}