Skip to main content
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
		}
	}
}

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook