I created a custom DateField
component. Everything is working fine but it gives the error Avoid mutating the prop 'value'
. It occurs when I close the menu by clicking Cancel
button or clicking outside.
Here is my code -
<template>
<v-menu
:close-on-content-click="false"
:return-value.sync="value"
max-width="290px"
min-width="290px"
offset-y
ref="menu"
transition="scale-transition"
v-model="menu"
>
<template v-slot:activator="{ on }">
<v-text-field
:label="label"
:placeholder="placeholder"
:value="value"
@input="$emit('input', $event)"
v-on="on"
:hint="hint"
/>
</template>
<v-date-picker
:value="dateValue"
@change="$emit('input', $event)"
no-title
scrollable
:type="type"
>
<v-spacer/>
<v-btn @click="menu = false" color="primary" text>Cancel</v-btn>
<v-btn @click="$refs.menu.save(value)" color="primary" text>OK</v-btn>
</v-date-picker>
</v-menu>
</template>
@click="menu = false"
, which I'm guessing menu is referencing the$store
property. You need to throw a proper commit e.g.@click= store.commit('menuOff')"
– A. L