在当前页实现禁止分享按钮已屏蔽,但如果该配置是写在入口文件App.vue
中,在跳转路由后屏蔽功能会失效,所以监听路由,如果有跳转,可以再进行一次屏蔽。
methods: {
wxUtils: function() {
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener(
"WeixinJSBridgeReady",
this.onBridgeReady,
false
);
} else if (document.attachEvent) {
document.attachEvent("WeixinJSBridgeReady", this.onBridgeReady);
document.attachEvent("onWeixinJSBridgeReady", this.onBridgeReady);
}
} else {
this.onBridgeReady();
}
},
onBridgeReady : function(){
WeixinJSBridge.call('hideOptionMenu');
}
},
mounted(){
this.wxUtils();
},
watch:{
$route(to,from){
if (to.path !== from.path) {
this.wxUtils()
}
}
}