#dynamic nuxt layers

1 messages · Page 1 of 1 (latest)

thick willowBOT
#

Hi @placid scarab. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the available knowledge sources, Nuxt layers are designed to extend and override files, components, and configuration in a composable way. You can stack multiple layers, and Nuxt will merge their contents, with the project itself having the highest priority. However, the selection and merging of layers are determined statically at build time via the extends property in nuxt.config, or by placing layers in the layers directory. There is no documented mechanism to dynamically switch or render a different layer's app.vue or index.vue at runtime based on a state value or condition.

You can, however, dynamically change layouts within a single Nuxt project using state or logic (for example, with setPageLayout or the <NuxtLayout> component), but this is not the same as dynamically switching between entire layers at runtime. Layers are a build-time feature, not a runtime one. The merging and extension happen before the app is started, not while it is running Authoring Nuxt Layers Getting Started: Layers.

If you need runtime dynamic rendering based on state, you should use layouts, components, or conditional rendering within your pages, not layers.

I'm sorry, but the knowledge sources do not mention a way to dynamically render a different layer's app.vue or index.vue at runtime based on a state value.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: