fix(nuxt): ensure injected route has enumerable keys (#28841)

This commit is contained in:
Daniel Roe 2024-09-05 08:33:07 +01:00 committed by GitHub
parent 30892da6ca
commit b0bf8b55fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,7 @@ export const RouteProvider = defineComponent({
for (const key in props.route) {
Object.defineProperty(route, key, {
get: () => previousKey === props.renderKey ? props.route[key as keyof RouteLocationNormalizedLoaded] : previousRoute[key as keyof RouteLocationNormalizedLoaded],
enumerable: true,
})
}

View File

@ -122,6 +122,7 @@ const plugin: Plugin<{ router: Router }> = defineNuxtPlugin({
for (const key in _route.value) {
Object.defineProperty(route, key, {
get: () => _route.value[key as keyof RouteLocation],
enumerable: true,
})
}