-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Use route name as page component's name as default #33254
Copy link
Copy link
Labels
Description
Describe the feature
There is an error happened when I use keepalive: { include: ['xxx'] } in NuxtPage
When I was arrange my page structure like this:
- pages
-- foo
--- index.vue
-- bar
--- index.vue
It render two pages with name foo and bar
I need to dynamicly add keepalive page, such as ['foo'], ['bar'], ['foo', 'bar'], when I was passing it to keepalive: {include:[]}, it didn't work at all.
The question is that the name of the component is neither foo or bar, is index instead, so keepalive component cannot keep the child component alive.
What I can do is to add
defineOptions({
name: 'foo',
})
to each component to change its name so that keepalive can work properly.
Is there any way to automaticly use route name as its component name?
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.
Reactions are currently unavailable