Have multiple layouts for one page depending on condition
I have a terms and conditions page, it should be viewed when logged in and not logged in. Unfortunately, I can't assign a condition to it
Error: "layout is not defined"
Thanks in advance!
3 Replies
definePageMeta
is a compiler macro. Referencing a variable that hasn’t yet been instantiated when this function is declared will result in it being undefined.
For the sake of “use this layout if the user is logged in”, pass computed as name
prop to NuxtLayout
you can also use
setPageLayout
function dynamically at runtime, but if you do that after mounted, you will get a slight blank display until the layout is fetched (unless you find the way to preload the layout first)Thank you guys, ofc i googled but didnt really know what to google...
Thats the thing cuebit talked about
And thats what akasection talked about