19 lines
392 B
19 lines
392 B
11 months ago
|
import { useRoute } from 'vue-router';
|
||
|
import { computed } from 'vue';
|
||
|
|
||
|
export function useRouteConfig(props: Recordable = {}) {
|
||
|
const route = useRoute();
|
||
|
function getMeta(key?: string) {
|
||
|
if (key) {
|
||
|
return route.meta[key];
|
||
|
}
|
||
|
return route.meta;
|
||
|
}
|
||
|
|
||
|
const getTitle = computed(() => {
|
||
|
return getMeta('title') || props.title;
|
||
|
});
|
||
|
|
||
|
return { getMeta, getTitle };
|
||
|
}
|