- 当前 Bug 的表现(可附上截图)
- 预期表现
控制台可以打印出:下载进度...
- 复现路径
- 提供一个最简复现 Demo
var loadSubPack = function () {
var loadingScene = require('src/loading-scene');
cc.director.runSceneImmediate(loadingScene);
const logger = wx.getLogManager();
logger.warn('开始加载分包...', Date.now());
let subtask = wx.loadSubpackage({
name: 'sub_pack',
success: function (res) {
logger.info('load sub_pack success...', Date.now());
console.log('分包加载成功后通过 success 回调');
try {
onStart();
} catch (ex) {
logger.warn('call onStart() failed', ex);
}
},
fail: function (res) {
logger.warn('call onStart() failed', ex);
const logger = wx.getLogManager();
logger.warn('分包加载失败通过 fail 回调', res);
log
ger.info('load sub_pack fail...', Date.now());
},
});
subtask.onProgressUpdate(res => {
console.log('下载进度', res.progress)
console.log('已经下载的数据长度', res.totalBytesWritten)
console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite)
})