The main entrance first determines whether the APP is open, and vuex saves the state
//判断是否是APP打开
checkApp(){
if(window.plus){
this.plusReady();
}else{
document.addEventListener( "plusready", this.plusReady, false );
}
},
plusReady(){
this.$store.state.isApp = true;
},
The specific page to click to enter the web address is as follows; mainly use plus.webview.create(url,id,{top:'40px'}), the new window is 40px from the top, this 40px can display a head, the head itself Set back button
//点击跳转到新的网络地址
goBanner(){
if (this.isApp) {
//显示跳转到网络地址的专用头部
this.$store.state.showNewWindow = true;
//H5+的API,不懂可以去研究下
this.$store.state.newWindow = plus.webview.create(this.dappDetail.website,this.dappDetail.id,{
top:"40px", //跟自己设置的头部一个高度
});
this.$store.state.newWindow.show();
} else {
//不是APP就直接在新窗口打开跳转页面
window.open(this.dappDetail.website,"_blank")
}
},
Head back button to close the newWindow of vuex.
//APP跳转到新页面后返回
goBack(){
//隐藏跳转到网络地址的专用头部
this.$store.state.showNewWindow = false;
this.$store.state.newWindow.close();
},