I have a scenario where I am using a component with tabs inside. The Head component (parent) includes the following code:
<v-btn @click="setSelectedTab('Set') "> ...
<component :is="selectedTab"></component>
Within the Set component (child component), I have some emits that will modify the data.
<div>
<head-set
v-show="showHeadSet"
@settings="
showHeadSet = false;
showScreenSettings = true;
"
@robotix="
showHeadSet = false;
showRobotix = true;
"
>
</head-set>
<Robotix v-show="showRobotix"></Robotix>
<screen-settings v-show="showScreenSettings"></screen-settings>
</div>
<script>
data() {
return {
showHeadSet: true,
showRobotix: false,
showScreenSettings: false,
};
},
</script>
When the button is clicked (
@click="setSelectedTab('Set') "
), my goal is to reset the data in the Set component back to its initial state (showHeadSet: true,showRobotix: false,showScreenSettings: false,
).
Do you have any suggestions on how to achieve this?