fix: useI18nMeta — remove RouteMeta import, fix callable narrowing, fix resolveI18nCustomTags return type
This commit is contained in:
parent
8971d0ddf2
commit
75d5cf24ad
1 changed files with 6 additions and 6 deletions
|
|
@ -2,7 +2,7 @@ import { computed, type ComputedRef, type Ref, unref, watch } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { useMeta, type MetaConfig, type LocaleAwareMeta } from './useMeta'
|
import { useMeta, type MetaConfig, type LocaleAwareMeta } from './useMeta'
|
||||||
import { useLocale, type LocaleId } from '../i18n'
|
import { useLocale, type LocaleId } from '../i18n'
|
||||||
import type { RouteMeta, RouteMetaValue } from '../types/route-meta.d'
|
import type { RouteMetaValue } from '../types/route-meta.d'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composable for i18n-aware meta tag management
|
* Composable for i18n-aware meta tag management
|
||||||
|
|
@ -49,7 +49,7 @@ export function useI18nMeta(
|
||||||
routeValue: typeof route
|
routeValue: typeof route
|
||||||
): T | undefined => {
|
): T | undefined => {
|
||||||
if (value === undefined) return undefined
|
if (value === undefined) return undefined
|
||||||
return typeof value === 'function' ? value(routeValue) : value
|
return typeof value === 'function' ? (value as Function)(routeValue) as T : value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -158,10 +158,10 @@ function resolveI18nCustomTags(
|
||||||
|
|
||||||
return customTags.map(tag => ({
|
return customTags.map(tag => ({
|
||||||
...tag,
|
...tag,
|
||||||
content: typeof tag.content === 'string' && typeof tag.content === 'object'
|
content: typeof tag.content === 'function'
|
||||||
? resolveI18nContent(tag.content as any, currentLocale) || ''
|
? ''
|
||||||
: typeof tag.content === 'function'
|
: typeof tag.content === 'object'
|
||||||
? tag.content
|
? resolveI18nContent(tag.content as any, currentLocale) || ''
|
||||||
: tag.content
|
: tag.content
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue