Mittelblut9
Mittelblut9
Explore posts from servers
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
check check :okok:
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
(i hope :lol: ) ... thank you!!! you dont know how many hrs i wasted on this bug :OMEGALULiguess:
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
it works
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
oh my god
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
lemme try
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
Nope
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
what da hell is definePageMeta doing in the data method..
9 replies
NNuxt
Created by Mittelblut9 on 3/30/2024 in #❓・help
Nuxt loading content from other pages
Its kind of a big file tbf... cutted some code out which isnt relevant like methods and data stuff
// /lobby
<template>
<div v-if="isInRoom">
Lobby stuff
</div>
<div v-else>
Here is the "Trete einem Raum bei"
</div>
<FooterComponent />
</template>

<script lang="ts">
export default {
name: 'LobbyPage',
setup(): any {
definePageMeta({
layout: 'default',
});
return {
userStore: useUserStore(),
toast: useToast(),
};
},
data(): any {
return {
...
};
},
beforeMount(): void {
This here is the part where everyone gets redirected to /game
globalThis.socket.on(CLIENT_EVENTS.startGameBroadcast, () => {
this.$router.push({
path: '/game',
});
});
},
};
</script>
// /lobby
<template>
<div v-if="isInRoom">
Lobby stuff
</div>
<div v-else>
Here is the "Trete einem Raum bei"
</div>
<FooterComponent />
</template>

<script lang="ts">
export default {
name: 'LobbyPage',
setup(): any {
definePageMeta({
layout: 'default',
});
return {
userStore: useUserStore(),
toast: useToast(),
};
},
data(): any {
return {
...
};
},
beforeMount(): void {
This here is the part where everyone gets redirected to /game
globalThis.socket.on(CLIENT_EVENTS.startGameBroadcast, () => {
this.$router.push({
path: '/game',
});
});
},
};
</script>
// /game
<template>
<div
v-show="loaded"
class="text-center top-50 start-50 translate-middle"
:class="{ 'position-absolute': loaded }"
>
game stuff
</div>
</template>

<script lang="ts">

export default {
name: 'GamePage',
setup(): any {
return {
userStore: useUserStore(),
};
},
data(): any {
definePageMeta({
layout: 'default',
});
return {
...
};
},
beforeMount(): void {
....
},
...
};
</script>
// /game
<template>
<div
v-show="loaded"
class="text-center top-50 start-50 translate-middle"
:class="{ 'position-absolute': loaded }"
>
game stuff
</div>
</template>

<script lang="ts">

export default {
name: 'GamePage',
setup(): any {
return {
userStore: useUserStore(),
};
},
data(): any {
definePageMeta({
layout: 'default',
});
return {
...
};
},
beforeMount(): void {
....
},
...
};
</script>
Hope this is helping if not - then yikes :LULE:
9 replies