14
rated 0 times
[
20]
[
6]
/ answers: 1 / hits: 5472
/ 4 Years ago, fri, march 20, 2020, 12:00:00
I have a basic input text field and want to reset it after submitting. When resetting it I currently update its v-model to an empty string. Unfortunately this triggers my input rules and renders an error message.
Code example:
<div id=app>
<v-app>
<v-text-field v-model=text :rules=[value => !!value || 'Required']></v-text-field>
<v-btn @click=text = ''>submit and reset</v-btn>
</v-app>
</div>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data() {
return {
text:
};
}
})
Is there a way I can empty the field without triggering the rule? I mean it behaves correctly and I would expect that, but when I click on the button I want to reset the field to its initial state.
More From » vue.js