vuepress-theme-ccds-test
Version:
This is an anime blog theme based on vuepress, the theme is simple, colorful, versatile, and supports customization, providing multiple components to set the theme
16 lines (15 loc) • 444 B
JavaScript
import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect';
/**
* Resolve NavLink props from string
*
* @example
* - Input: '/接口.md'
* - Output: { text: 'Home', link: '/' }
*/
export const useNavLink = (item) => {
const resolved = useResolveRouteWithRedirect(item);
return {
text: resolved.meta.title || item,
link: resolved.name === '404' ? item : resolved.fullPath,
};
};