Commit 6f9f1713 authored by 袁玲利's avatar 袁玲利

游戏排行榜

parent a1ad2364
......@@ -114,19 +114,6 @@ export default {
};
},
mounted() {
const that = this;
// 监听返回
this.pushHistory();
window.addEventListener(
"popstate",
function (e) {
// 为了避免只调用一次
that.pushHistory("title1");
// 自定义方法, 直接关闭网页或返回小程序上一页
that.goBack();
},
false
);
this.games.sort(() => 0.5 - Math.random());
this.params.userid = this.getQueryParams("userId");
this.params.sessionid = this.getQueryParams("sessionid");
......@@ -136,18 +123,6 @@ export default {
this.init();
},
methods: {
// 添加一条 history 实体作为替代原来的 history 实体
pushHistory(str = "title", url = "#") {
const state = {
title: str,
url,
};
window.history.pushState(state, state.title, state.url);
},
goBack() {
console.log('游戏排行榜的物理返回按钮')
wx.miniProgram.postMessage({ data: { behavior: 'back'} })
},
init() {
const self = this;
this.timer = setInterval(() => {
......@@ -254,6 +229,7 @@ export default {
},
},
onHide() {
console.log('111111111')
this.params.behavior = "viewPage";
this.params.data = "closePage";
this.GameStatistics();
......@@ -262,6 +238,16 @@ export default {
this.timer = null;
}
},
beforeRouteLeave(to,from,next){
console.log('222222222222')
wx.miniProgram.postMessage({
data: {
cardId: 0,
title: '电子名片'
}
})
next()
},
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment