update useDocLink

pull/20801/head
Bowen Liang 12 months ago
parent 0e8c76599c
commit f3a198391e

@ -40,8 +40,8 @@ export const useDocLink = (baseUrl?: string): ((path?: string, pathMap?: { [inde
let baseDocUrl = baseUrl || defaultDocBaseUrl let baseDocUrl = baseUrl || defaultDocBaseUrl
baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl
const { locale } = useI18N() const { locale } = useI18N()
const docLanguage = getDocLanguage(locale)
return (path?: string, pathMap?: { [index: string]: string }): string => { return (path?: string, pathMap?: { [index: string]: string }): string => {
const docLanguage = getDocLanguage(locale)
const pathUrl = path || '' const pathUrl = path || ''
let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl
targetPath = (targetPath.startsWith('/')) ? targetPath.slice(0, -1) : targetPath targetPath = (targetPath.startsWith('/')) ? targetPath.slice(0, -1) : targetPath

Loading…
Cancel
Save