UpdateManager.onUpdateReady
解释:当新版本下载完成,会进行回调。
方法参数
Function callback
示例
在开发者工具中预览效果
扫码体验
请使用百度APP扫码
代码示例
-
<view class="container"> <view class="card-area"> <view class="top-description border-bottom">此api会在旧版小程序在成功拉到最新包时触发</view> </view></view>
-
Page({ data: { }, onLoad() { const updateManager = swan.getUpdateManager(); updateManager.onUpdateReady(function (res) { // 请求完新版本信息的回调 console.log("res", res); if(!res.hasUpdate){ swan.showModal({ title: '更新提示', content: '新版本下载完成啦, 是否应用', }); } }); }});
