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

This commit is contained in:
Daniel Roe 2024-09-05 08:33:07 +01:00
parent 77bd30a0b8
commit 74985a5251
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
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,
})
}