I have a project where I need to use Buefy timepicker. There is an input which contains the value selected in the picker. Everything works well except the input element which I thing should be cleared if the model is set to null. The code looks like:
<b-field>
<b-timepicker
v-model="newTimeFrom"
editable
trap-focus
icon="clock"
:incrementMinutes="5"
:placeholder="Set time from"
class="mb-2"
>
</b-timepicker>
<b-timepicker
v-model="newTimeTo"
editable
trap-focus
icon="clock"
:incrementMinutes="5"
:placeholder="Set time to"
class="mb-2"
>
</b-timepicker>
</b-field>
and there are some watchers which should get the value from model variables and then set model variables to null.
data() {
return {
newTimeFrom: null,
newTimeTo: null,
times: [],
};
},
watch: {
newTimeFrom(newTimeFrom) {
if( !this.newTimeTo ) return;
this.times.push([newTimeFrom, this.newTimeTo]);
this.newTimeFrom = this.newTimeTo = null;
},
newTimeTo(newTimeTo) {
if( !this.newTimeFrom ) return;
this.times.push([this.newTimeFrom, newTimeTo]);
this.newTimeFrom = this.newTimeTo = null;
}
},
Can somebody tell me what is wrong with this code?