当前位置:网站首页>#微信小程序# 在小程序里面退出退出小程序(navigator以及API--wx.exitMiniProgram)
#微信小程序# 在小程序里面退出退出小程序(navigator以及API--wx.exitMiniProgram)
2022-06-26 04:33:00 【楚君君】
需求:
在微信小程序里面,点击“取消”字样即可退出小程序,返回微信聊天界面
效果:

步骤:
方法一:
直接使用uni-app的组件——navigator,修改参数open-type="exit" target="miniProgram"即可
(直接退出,不需要执行其他操作)
<navigator open-type="exit" target="miniProgram" >取消</navigator> 方法二:
使用微信小程序API--wx.exitMiniProgram
(适用于退出时,清除缓存等操作)
设置点击事件:
<view @click="exitApplet()">取消</view>设置api(在success函数里面可以写入一些退出小程序时,要执行的操作)
//退出小程序
exitApplet() {
wx.exitMiniProgram({
success: function () {
postCancelLogin({unique_id:this.unique_id}).then((res => {
uni.removeStorageSync('iv'); //清除缓存
uni.removeStorageSync('encryptedData');
}))
}
})
}
边栏推荐
- Review of number theory
- CTF serialization and deserialization
- SixTool-多功能多合一代挂助手源码
- Tp6 multi table Association (table a is associated with table B, table B is associated with table C, and table d)
- Introduction to markdown grammar
- "Eight hundred"
- Principle and implementation of syn cookie
- What are the advantages and risks of paper gold investment
- Zhubo Huangyu: you can try these non-agricultural operation skills
- Video label forbids downloading. The test is valid. Hide button. The test is valid at three points
猜你喜欢

Thinkphp6 using kindeditor

Essential foundation of programming - Summary of written interview examination sites - computer network (1) overview

TP5 distinct method paging problem

Install cenos in the virtual machine
![Simple personal summary of tp6 multi application deployment -- Part I [original]](/img/7b/65fab1973423081483dacc9bed9594.jpg)
Simple personal summary of tp6 multi application deployment -- Part I [original]

Motivational skills for achieving goals

NPM installation tutorial

Physical design of database design (2)

CDN with OSS acceleration

Navicat connects the pit of shardingsphere sub table and sub library plug-ins
随机推荐
Solution to composer error could not find package
Laravel framework Alipay payment fails to receive asynchronous callback request [original]
pip 批量完全卸载包
digital image processing
1.17 learning summary
排序查询
PHP installation SSH2 extension
What should I do if I don't understand the precious metal indicators
Thinkphp6 implements a simple lottery system
[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions
Ueeditor automatically appends P tags to rich text.br tags always wrap.br tag solutions
Minecraft 1.16.5 biochemical 8 module 1.9 version 1.18 version synchronization
Install Damon database
问题随记 —— pip 换源
Report on demand situation and development trend of China's OTC industry from 2022 to 2028
Thymeleaf data echo, single selection backfill, drop-down backfill, time frame backfill
08_ Spingboot integrated redis
PHP has the problem of using strtotime to obtain time in months and months [original]
35岁程序员炒Luna 千万资产3天归零,网友:和赌博一样
Clickhouse stand alone installation