[Vuejs]-Avoid mutating a prop directly error in vue js

0👍

You didn’t give the script part so i’m going to do some assumptions..

In any case, you can use $emit that will send a signal to the "father component(the component that passed the menu prop)" and you can receive that signal in the father component using @emitName and changing the value there

Example:

<v-btn @click="$emit('cancel')" color="primary" text>Cancel</v-btn>

In the father component:

<SonComponent :menu="menuData" @cancel="menu=false" />

You can learn more from this here

Hope this helps.

Leave a comment