UNPKG

vuepress-theme-aurora

Version:

A vuepress-based animation blog theme, simple, beautiful, multi-color, multiple custom functions, providing article poster sharing, talk, photo album, comment and other features 一个基于vuepress的动漫类博客主题,简洁,漂亮,多色彩,多种自定义功能,提供文章海报分享,说说,相册,评论等特色功�?

25 lines (24 loc) 870 B
import { isFunction, isString } from '@vuepress/shared'; import { useRouter } from 'vue-router'; /** * Resolve a route with redirection */ export const useResolveRouteWithRedirect = (...args) => { const router = useRouter(); const route = router.resolve(...args); const lastMatched = route.matched[route.matched.length - 1]; if (!(lastMatched === null || lastMatched === void 0 ? void 0 : lastMatched.redirect)) { return route; } const { redirect } = lastMatched; const resolvedRedirect = isFunction(redirect) ? redirect(route) : redirect; const resolvedRedirectObj = isString(resolvedRedirect) ? { path: resolvedRedirect } : resolvedRedirect; return useResolveRouteWithRedirect({ hash: route.hash, query: route.query, params: route.params, ...resolvedRedirectObj, }); };