模拟器中wx-open-launch-weapp无法正常使用,真机可以。另外模拟机无法触发visibilitychange,真机可以代码如下:
<wx-open-launch-weapp id="weapp_phone" style="width:100%;height:100%;" username="<?=$appid?>" path="/pages/reg/reg<?=$parms?>">
<script type="text/wxtag-template">
<div style="height:100%;width:100%;text-align: center;">自动获取</div>
</script>
</wx-open-launch-weapp>
document.addEventListener("visibilitychange", function() {
console.log('visibilitychange');
if (document.visibilityState === 'hidden') {
}else{
if (document.visibilityState === 'visible') {
if(isJumpingToMini){
//从小程序回来的
isJumpingToMini=false;
get_phone_data();
}
}
}
});
你好,以真机表现为准