当前位置:网站首页>Uniapp custom application exit execution content
Uniapp custom application exit execution content
2022-07-25 05:12:00 【Mr_ Bobcp】
Application scenarios
App Platform environment , I hope to do something when I quit the application , Official documents also provide methods , link :https://ask.dcloud.net.cn/article/35120, Here we use another .
The specific content
The inspiration comes from the previous reading about rewriting the return method to let App Articles that do not exit but run in the background
Mention that you can main.js Revision in China plus.runtime.quit() = function(){...}, Then the same reason https://www.html5plus.org/doc/ and https://developer.android.google.cn/ A solution can be obtained by referring to the application activities and exits in :
// modify main.js, Add content at the end of the code segment , This is the Android version for reference
// #ifdef APP-PLUS
let main = plus.android.runtimeMainActivity();
// rewrite plus.runtime.quit
plus.runtime.quit = function(){
uni.showModal({
title: ' Tips ',
content: ' Whether to exit the application ?',
success: function(res) {
if (res.confirm) {
// The code to operate when exiting
// ...
// Exit the current application , Change method only in App Enter into force
main.finish();
} else if (res.cancel) {
// console.log(' The user clicks cancel ');
}
}
});
};
// #endif
边栏推荐
- [live review] AI customer service "changes according to the situation", and man-machine dialogue can be easier
- Unity LOD
- 一篇文章带你读懂Redis的哨兵模式
- Basic knowledge of scratch crawler framework
- Get the parameters of the browser address bar
- Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
- Redis的三个必知必会的问题
- HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier
- Delivery practice of private PAAS platform based on cloud native
- When image component in wechat applet is used as background picture
猜你喜欢
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

Forwarding and sharing function of wechat applet

Teach you three ways to optimize the performance from 20s to 500ms

epoll的实现原理

When we talk about immutable infrastructure, what are we talking about

Implementation of recommendation system collaborative filtering in spark

Special analysis of data security construction in banking industry

Thesis reading | which is the best multilingual pre training technology for machine translation? See the latest progress!

ES6 -- Methods and extensions of array objects, traversal of arrays, and extension methods of strings

Information System Project Manager --- Chapter IX examination questions of project human resource management over the years
随机推荐
Ffmpeg download and installation
[c language] custom type (structure ~ enumeration ~ Union)
JS common code questions array de duplication - Custom New throttling and anti shake - deep copy - instanceof URL parameter extraction - thousand separator - array to tree structure - array flattening
Learn to use PHP to get the URL address link after resetting
[globally unique ID] how to handle the ID primary key after dividing the database and table?
Nexttick principle analysis
DOM processing in ahooks
Analysis of lottery winning numbers in history
服务器防护的七个建议
Seven suggestions for Server Protection
STM32 Development Notes 118: using CMSIS DSP Library in stm32cube IDE
Compile ue5.0
[the most comprehensive and detailed] how to design a database and table splitting scheme that can dynamically expand and shrink capacity?
哪种网站适合物理服务器
What is virtual DOM? How to implement a virtual DOM
Leetcode55. Jumping game
Introduction to CpG control network
Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
When we talk about immutable infrastructure, what are we talking about
The strongest JVM in the whole network is coming!