nuxt-modules / ionic

Batteries-included, zero-config Ionic integration for Nuxt
https://ionic.nuxtjs.org
MIT License
373 stars 38 forks source link

Alternative to NuxtLayout? #487

Open scalemaildev opened 10 months ago

scalemaildev commented 10 months ago

🆒 Your use case

I'd like to use Nuxt's layouts feature for my app but the docs warn me away from use of NuxtLayout proper.

🆕 The solution you'd like

An ion alternative to NuxtLayout, or if one already exists, instructions added to the nuxt/ionic docs (under Watchouts).

🔍 Alternatives you've considered

Currently I'm using NuxtLayout against the doc's advice by using the code snipper in https://github.com/nuxt-modules/ionic/issues/231#issuecomment-1409776448 wrapping it within ion-app.

ℹī¸ Additional info

No response

Ismaele-silla commented 10 months ago

I came here just to write the same request. Nuxt layouts are awesome, it's sad we can't use them by default (thanks for the awesome work so far)

StevenGFX commented 9 months ago

Came here for this as well and was looking for a suitable work-around but doesn't seem to be one at this time. đŸ˜ĸ

unitythemaker commented 3 months ago

For anyone needing a workaround, you can create a component like this and use it everywhere: components/layout/Default.vue

<template>
  <ion-page>
    <ion-content class="h-screen overflow-hidden">
      <Toaster />
      <div class="app-padding font-default bg-background h-screen flex flex-col">
        <slot />
      </div>
    </ion-content>
  </ion-page>
</template>

pages/welcome.vue

<template>
  <LayoutDefault>
    ...
  </LayoutDefault>
</template>

I really would love to have layouts though. I need this feature to not wrap every page in a custom component like above.