[Vuejs]-Setting Vuetify Circular Progress Bar value after uploading image to firebase store

0👍

I solved this issue using Emit Bus Feature of Vue

uploadTask.on(
        "state_changed",
        function(snapshot) {
          this.percent = snapshot.bytesTransferred / snapshot.totalBytes * 100;
          this.percent = Number(this.percent.toFixed(3).slice(0, -1));
          EventBus.$emit("upload-progress", this.percent);
          console.log("Upload is " + this.percent + "% done");
        },
        function error(err) {},
        function complete() {
          console.log("Upload finished!!!!");
        }
      );
    },

and

mounted() {
    this.$validator.localize("en", this.dictionary);
    this.interval = setInterval(() => {
      if (this.value === 100) {
        return (this.value = 100);
      }
      EventBus.$on("upload-progress", percent => {
        this.value = percent;
      });
    }, 1000);
  },

Leave a comment