Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I reset the compoents? #2

Open
TaurusWood opened this issue Jun 6, 2017 · 3 comments
Open

How can I reset the compoents? #2

TaurusWood opened this issue Jun 6, 2017 · 3 comments

Comments

@TaurusWood
Copy link

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

@diegomengarda
Copy link

diegomengarda commented Oct 5, 2017

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>

@huangche007
Copy link

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

@diegomengarda
Copy link

Nice, works perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants