如何退出app的操作

很多小伙伴们在制作app时不知道如何退出操作,今天给大家介绍一下:

如何退出app的操作插图亿华云代码如下:

componentDidMount(){//plusPredy准备工作 用于监听首页退出事件if(window.plus){//当有plus时,直接plusPredythis.plusready.bind(this)()}else{//当没有plus时,要先创造plusready事件
document
.addEventListener(plusready,this.plusready.bind(this),false)}}plusready(){// 监听首页退出let first =nullif(!first){//若2s内没有连续点击返回按钮 则只弹出提示 不退出
first
=newDate().getTime()
plus
.nativeUI.toast("再按一次退出应用",{
background
:rgba(255, 255, 255, 0.6),})setTimeout(function(){
first
=null},2000)}else{//若2s内连续点击返回键 则退出if(newDate().getTime()- first

THE END
Copyright © 2024 亿华云