h5使用
new Vue({
el: '#app',
data: {
},
created () {
console.log('created-什么周期')
},
async mounted () {
window.addEventListener(
"pageshow",
function () {
console.log("页面重新显示");
},
false
);
},
methods: {
jumpTn () {
window.location.href = 'https://www.baidu.com'
}
}
})
h5和小程序webview跳转其他webview都能使用
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script>
var vConsole = new VConsole();
new Vue({
el: '#app',
data: {
},
created () {
console.log('created-什么周期')
},
async mounted () {
document.addEventListener("visibilitychange", function () {
console.log('触发了visibilitychange')
if (document.visibilityState === 'visible') {
console.log('yem 页面隐藏了')
} else {
console.log('页面显示了')
}
});
},
methods: {
jumpTn () {
// window.location.href = 'https://www.baidu.com'
wx.miniProgram.navigateTo({
url: '/pages/webPage/webPage?pageSrc=' + encodeURIComponent('https://www.baidu.com'),
});
}
}
})
</script>
网友评论