Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

You need to put the reset inside Vue.nextTick and then it'll work.

you can use:

Vue.nextTick(() => {
      this.$v.$reset()
    });

or

 

this.$nextTick(() => { this.$v.$reset() })

 

Example how to use Vue::nextTick():

 

// the component
export default {
	data() {
		return {
			foo: null,
			bar: null
		}
	},
	validations: {
		foo: {
			required,
			minLength: minLength(5),
			maxLength: maxLength(15)
		},
		bar: {
			required
		}
	},
	methods: {

		onFormSubmit() {
			
			// this works even better - using Vue.nextTick method
			this.$nextTick(() => { this.$v.$reset() })
                        // reset your fields here
		}
	}
}

Comments

Add new comment

Restricted HTML

Search

Page Facebook

Become a patron

If you need some help or you search a Drupal freelancer don't hesitate to contact us.

 

Contact Us

All the content is FREE but I still need your help

 

Become a patreon