0👍
It’s been a while since I was fluent in React, but my reading of the React Router docs on <Route> tells me
The Route component[‘s] … most basic responsibility is to render some UI when its path matches the current URL.
Briefly scanning the Vue Router docs I don’t see an existing component that provides that functionality, but a basic version would be simple to implement with Vue:
<!--Route.vue-->
<template>
<slot v-if="route.path.includes(props.path)"></slot>
</template>
<script setup>
const props = defineProps({ path: String })
const route = useRoute()
</script>
That should fulfill the basic use case of the React version. You can get a lot more complex with it, or not, thus is the beauty of Vue. : )
- [Vuejs]-How can I capture the data from a component input?
- [Vuejs]-Cypress: after clicking button page doesn't open
Source:stackexchange.com