当前位置:首页 > 技术教程 > 正文

如何退出app的操作

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

如何退出app的操作 第1张

如何退出app的操作 第2张

代码如下:

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

<2000){

plus

.

storage

.clear()//清空缓存

plus

.

runtime

.quit()//退出app}}},false)}

以上是关于“选择服务器托管还是选择服务器租赁好?”的介绍,如需购买云服务器,推荐西西云,独享IP、独享云服务器齐备,各类配置均有,最低只需要43/月,免费帮助配置环境,挂载磁盘等,协助处理简单问题,同时提供快速0元备案,让你快速运营。

如何退出app的操作 第3张

选购地址:

https://www.kufanyun.com/server/buy.html

app
0