vue-datetime
vue-datetime copied to clipboard
Initial input event firing with vee-validate
Versions
- vue: 2.6.10
- vue-datetime: 1.0.0-beta.10
- luxon: 1.16.0
Description:
Why is an input event fired with initial values? This interferes with vee-validation that works on input event.
Steps To Reproduce:
template: <datetime v-model="model.test1" @input="debug('test1')" /> <input v-model="model.test2" @input="debug('test2')" />
method: debug(event) { console.log(event); }
"test1" displayed in console and "test2" didn't
It is fired on created hook to format the initial value. For vee-validate 2.x you can disable auto validation with data-vv-validate-on="none"
and run it on close
event.
@mariomka how to prevent the initial input event ? I have an auto save feature on a form, and every time the form is shown, it triggers my API calls
Firing an initial input event is a little incorrect, don't you think @mariomka? Like... input is meant for when data is entered and most libraries use it at such. So when this library fires an initial input event, that leads to issues. What if there is no initial value?