微信里打开html 隐藏微信右上角里的分享

首先要引用微信的js

<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

然后在页面里加上如下代码即可  如果要显示hideOptionMenu 替换 showOptionMenu

<script>
$(document).ready(function(){
	alert(111)

	function onBridgeReady(){
	 WeixinJSBridge.call('hideOptionMenu');
	}
	
	if (typeof WeixinJSBridge == "undefined"){
	    if( document.addEventListener ){
	        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
	    }else if (document.attachEvent){
	        document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
	        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	    }
	}else{
	    onBridgeReady();
	}
})
</script>

最终效果

 

 

在uniapp微信小程序中,可以使用uni-ui组件库中提供的弹窗组件来实现弹窗右上角添加关闭icon的效果。 首先,在需要使用弹窗的页面中引入uni-ui组件,具体步骤为在pages.json文件中添加如下代码: ```json "easycom": { "autoscan": true, "custom": { "^@dcloudio/uni-ui": "@/uni-ui" } } ``` 然后,在需要使用弹窗的页面中引入弹窗组件,具体步骤为在页面的vue文件中添加如下代码: ```html <template> <view> <uni-popup :show="showPopup" :position="position"> <view>这是弹窗内容</view> <view class="close-icon" @click="closePopup">关闭</view> </uni-popup> </view> </template> <script> import { uniPopup } from '@dcloudio/uni-ui'; export default { components: { uniPopup }, data() { return { showPopup: false, position: 'center' }; }, methods: { openPopup() { this.showPopup = true; // 打开弹窗 }, closePopup() { this.showPopup = false; // 关闭弹窗 } } } </script> <style> .close-icon { position: absolute; top: 0; right: 0; width: 30px; height: 30px; text-align: center; line-height: 30px; background-color: rgba(0,0,0,0.5); color: #fff; cursor: pointer; z-index: 3; } </style> ``` 以上代码中,通过引入uniPopup组件,并使用show属性来控制弹窗的显示与隐藏。通过添加close-icon类及相应的样式,实现右上角的关闭icon,并通过绑定closePopup方法来关闭弹窗。 最后,在需要显示弹窗的事件中,调用openPopup方法来打开弹窗,即可在右上角看到带有关闭icon的弹窗。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值