Created
December 11, 2021 19:48
-
-
Save sadewole/2be96a966f0288fbece6a7de0716a6ef to your computer and use it in GitHub Desktop.
Tabs.vue - script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { watch, ref, provide, defineComponent } from "vue"; | |
export default defineComponent({ | |
name: "Tabs", | |
props: { | |
groupName: { type: String, required: true }, | |
initialTab: { type: String, required: true }, | |
}, | |
emits: ["change"], | |
setup(props, { emit }) { | |
const selectedTab = ref(props.initialTab); | |
watch( | |
() => selectedTab.value, | |
() => emit("change", selectedTab.value) | |
); | |
provide("groupName", props.groupName); | |
provide("selectedTab", selectedTab); | |
}, | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment