需求
- 点击游戏进入游戏页面,游戏页面点击返回时关闭游戏页面并回到进入游戏前的页面
- 应用与游戏使用相互独立的webkit
具体实现
游戏列表页
点击某一项进入游戏页面
methods: {
toGame() {
this.$router.push("/gameContent?id=1");
}
}
游戏页
- 进入时开启,退出时需先关闭webview再退出
- 移动端按钮返回见游戏移动端按钮返回
<template>
<div>
<div class="header">
<img src="@img/white-left.png" alt @click="goBack" />
</div>
</div>
</template>
<script>
export default {
name: "index",
data() {
return {
id: 0
};
},
created() {
this.id = location.search.slice(1).split("&")[0].split("=")[1];
this.onPlusReady(() => {
this.plusR