useRouteBaseName()
组合函数返回一个获取路由基本名称的函数。
declare function useRouteBaseName(
options?: I18nCommonRoutingOptionsWithComposable
): (givenRoute?: Route | RouteLocationNormalizedLoaded) => string | undefined
<script setup>
const route = useRoute()
const getRouteBaseName = useRouteBaseName()
const baseRouteName = computed(() => {
return getRouteBaseName(route)
})
</script>
<template>
<p>路由基本名称: {{ baseRouteName }}</p>
</template>