vuetify-form-base
vuetify-form-base copied to clipboard
Clearing date picker doesn't clear the model value
When setting the date-picker text field to be clearable the value is cleared but not updated on the form model. You can inspect the same behavior on the demo using the time picker via https://wotamann.github.io/pickers .
I was able to listen to an event by adding changing:
<v-menu
v-else-if="isDateTimeColorTypeAndExtensionText(obj)"
v-bind="bindSchemaMenu(obj)"
>
<template v-slot:activator="{ on }">
<v-text-field
v-on="on"
v-bind="bindSchemaText(obj)"
:value="setValue(obj)"
@[suspendClickAppend(obj)]="onEvent($event, obj, append)"
@click:append-outer="onEvent($event, obj, appendOuter)"
@click:prepend="onEvent($event, obj, prepend)"
@click:prepend-inner="onEvent($event, obj, prependInner)"
@click:clear="onEvent($event, obj, clear)" // <------------------ ADDED THIS
/>
<!-- SLOTS append|prepend|message for picker not avilable, try custom component -->
</template>
<component
:is="mapTypeToComponent( obj.schema.type )"
v-bind="bindSchema(obj)"
:type="checkInternType(obj)"
:value="setValue(obj)"
@input="onInput($event, obj)"
@click:hour="onEvent({type:'click'}, obj, hour)"
@click:minute="onEvent({type:'click'}, obj, minute)"
@click:second="onEvent({type:'click'}, obj, second)"
/>
</v-menu>
Ideally the form should update the model on a clear event, but by using the added event I was able to handle the clear manually. If you have time it would be awesome if you could update the core to handle this more elegantly. thanks