当前位置:网站首页>uniapp小程序检查、提示更新
uniapp小程序检查、提示更新
2022-07-31 21:33:00 【寒墨茗殇】
上代码:
xcxCheckUpdate.js
export default function xcxCheckUpdate(){
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function (res) {
// 新的版本下载失败
});
}
App.vue:
<script>
import xcxCheckUpdate from 'xcxCheckUpdate.js'
export default {
// 检测小程序更新
xcxCheckUpdate()
}
</script>
边栏推荐
- Niuke.com brush questions (1)
- Commonly used security penetration testing tools (penetration testing tools)
- 统计UTF-8字符串中的字符函数
- sqlite3简单操作
- Basic Grammar Introduction of Carbon Tutorial (Tutorial)
- Golang - from entry to abandonment
- Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...
- 【核心概念】图像分类和目标检测中的正负样本划分以及架构理解
- Quick Start Tutorial for flyway
- Realize serial port receiving data based on STM32 ring queue
猜你喜欢
focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
Count characters in UTF-8 string function
高通cDSP简单编程例子(实现查询高通cDSP使用率、签名),RK3588 npu使用率查询
TestCafeSummary
The article you worked so hard to write may not be your original
Shell 脚本 快速入门到实战 -02
角色妆容的实现
Socket回顾与I/0模型
The principle of ReentrantLock (to be continued)
Architect 04 - Application Service Encryption Design and Practice
随机推荐
Realization of character makeup
"The core concept of" image classification and target detection in the positive and negative samples and understanding architecture
-xms -xmx(information value)
C程序设计-方法与实践(清华大学出版社)习题解析
全网一触即发,自媒体人的内容分发全能助手——融媒宝
Financial profitability and solvency indicators
Architecture Battalion Module 8 Homework
Chapter VII
高效并发:Synchornized的锁优化详解
嵌入式开发没有激情了,正常吗?
Memblaze发布首款基于长存颗粒的企业级SSD,背后有何新价值?
How to change npm to Taobao mirror [easy to understand]
请问我的这段sql中sql语法哪里出了错
ThreadLocal
关注!海泰方圆加入《个人信息保护自律公约》
顺序表的实现
Niuke.com brush questions (1)
Go mode tidy reports an error go warning “all” matched no packages
Douyin fetches video list based on keywords API
Arduino框架下STM32全系列开发固件安装指南