Vue.js Vue变量未在方法的异步中更新

Vue.js Vue变量未在方法的异步中更新,vue.js,asynchronous,async-await,Vue.js,Asynchronous,Async Await,我正在尝试在Vue方法中更新进度条。为什么这不起作用?它似乎只是方法完成后的最终值。起初,我是同步下载的,但切换到异步迭代器,认为它可以解决我的问题 异步下载游戏(){ const storage=firebaseInstance.storage(); const pathReference=storage.ref(this.game.filePath); const url=await pathReference.getDownloadURL(); const resp=等待获取(url);

我正在尝试在Vue方法中更新进度条。为什么这不起作用?它似乎只是方法完成后的最终值。起初,我是同步下载的,但切换到异步迭代器,认为它可以解决我的问题

异步下载游戏(){
const storage=firebaseInstance.storage();
const pathReference=storage.ref(this.game.filePath);
const url=await pathReference.getDownloadURL();
const resp=等待获取(url);
const length=resp.headers.get('Content-length')
常量数组=新的UINT8数组(长度);
设指数=0;
对于wait(this.streamasynciteable(resp.body))的const块){
set(块,索引);
index+=chunk.length;
this.gameDownloadProgress=索引/长度;
console.log(this.gameDownloadProgress);
}
this.romBuffer=数组
},
async*streamAsyncIterable(流){
const reader=stream.getReader();
试一试{
while(true){
const{done,value}=wait reader.read();
如果(完成){
返回
}
收益值;
}
}最后{
reader.releaseLock()文件
}
},

您在此处发布的代码运行良好。看见