I'm using vue-material.io, the datepicker particularly.
But I've got a problem during state observation.
The watcher triggers twice. Is this a package bug or vue's nature?
How to reproduce:
Try to select a date and see console.
You can see it triggers twice unexpectedly.
https://codesandbox.io/s/vue-material-basic-example-hxzwp
I think this has to do with a watcher inside the component. If you change the date by clicking it, it sets the data and emits it. Then the internal watcher kicks in and also changes the data by formatting it and emits the value again. This way you watcher gets triggered twice.
The behaviour can feel strange but it's correct.
If you want you can check out the source code here: https://github.com/vuematerial/vue-material/blob/dev/src/components/MdDatepicker/MdDatepicker.vue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With