vue-base64-file-upload icon indicating copy to clipboard operation
vue-base64-file-upload copied to clipboard

How can I reset the compoents?

Open TaurusWood opened this issue 8 years ago • 3 comments

when I finish the first upload, or I want to clear this upload task? I think it need a clear or reset API

TaurusWood avatar Jun 06 '17 02:06 TaurusWood

You can put the v-if directive and change to false and to true again, this will reset de component. Something like this:

<template>
  
  <vue-base64-file-upload v-if="isAvailable"/>
    
  <button @click="reset">Reset</button>
  
</template>
  
<script>
export default {
    components: {
      VueBase64FileUpload
    },
    data () {
      return {
        isAvailable: true
      }
    },
    methods: {
      reset () {
        this.isAvailable = false
        setTimeout(() => {
          this.isAvailable = true
        }, 50)
      }
    }
}
</script>

diegomengarda avatar Oct 05 '17 12:10 diegomengarda

@diegomengarda this code should as follow: reset () { this.isAvailable = false const _this =this setTimeout(() => { _this.isAvailable = true }, 50) }

huangche007 avatar Jan 09 '18 07:01 huangche007

Nice, works perfect.

diegomengarda avatar Mar 07 '18 18:03 diegomengarda