前端希望能以文字顯示現在上傳的進度
如:
上傳的部分是沒有問題的,獲取進度的程式碼在主控台也是沒問題的
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log("Upload is " + this.progress + "% done");
整段上傳的程式碼
uploadTask.on(
"state_changed",
function(snapshot) {
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log("Upload is " + this.progress + "% done");
switch (snapshot.state) {
case firebase.storage.TaskState.PAUSED: // or 'paused'
console.log("Upload is paused");
break;
case firebase.storage.TaskState.RUNNING: // or 'running'
console.log("Upload is running");
break;
}
},
);
前端的程式碼
上傳進度 : {{progress}} %
progress一開始就設為 0
data() {
return {
progress: 0,
};
但我的畫面永遠顯示
上傳進度 : 0 %
前端畫面並沒有隨著資料更新,想請問是哪邊出問題?