closeWindow() {
if (document.addEventListener) {
document.addEventListener(
'WeixinJSBridgeReady',
function () {
WeixinJSBridge.call('closeWindow');
parent.WeixinJSBridge.call('closeWindow');
},
false
);
} else if (document.attachEvent) {
document.attachEvent('onWeixinJSBridgeReady', function () {
//这个可以关闭ios系统的手机
WeixinJSBridge.call('closeWindow');
});
}
// 必须加最后这一句,否则关闭不了
WeixinJSBridge.call('closeWindow');
}
```s
标签:微信,WeixinJSBridge,addEventListener,attachEvent,closeWindow,call,按钮,document,页面
From: https://www.cnblogs.com/sinceForever/p/18041424