1👍
✅
Set those localStorage
fields to empty strings in submitForm()
:
methods() {
submitForm: function() {
axios({
/*...*/
}).then(response => {
localStorage.category = '';
localStorage.title = '';
localStorage.address = '';
localStorage.city = '';
localStorage.state = '';
localStorage.zip = '';
localStorage.price = '';
localStorage.description = '';
this.category = '';
this.title = '';
this.address = '';
this.city = '';
this.state = '';
this.zip = '';
this.price = '';
this.description = '';
/*...*/
}).catch(error => {
/*...*/
})
}
}
2👍
From MDN docs on localStorage
, use:
localStorage.clear()
This still won’t reset your vue data until the page is refreshed. You will have to do that separately.
Source:stackexchange.com