Composables

useRouteBaseName

The useRouteBaseName() composable returns a function that gets the route's base name.

The useRouteBaseName() composable returns a function that gets the route's base name.

Type

declare function useRouteBaseName(
  options?: I18nCommonRoutingOptionsWithComposable
): (givenRoute?: Route | RouteLocationNormalizedLoaded) => string | undefined

Usage

<script setup>
const route = useRoute()
const getRouteBaseName = useRouteBaseName()
const baseRouteName = computed(() => {
  return getRouteBaseName(route)
})
</script>

<template>
  <p>route base name: {{ baseRouteName }}</p>
</template>

Copyright © 2024