SzaDave 👽
SzaDave 👽
NNuxt
Created by SzaDave 👽 on 5/21/2024 in #❓・help
How to Enable Vue Vapor Mode globally in Nuxt?
Hi everyone, I’m looking to enable Vue’s Vapor Mode in my Nuxt project globally. Does anyone have experience with this or know the steps involved? Any guidance or documentation links would be greatly appreciated! Thanks in advance!
1 replies
NNuxt
Created by SzaDave 👽 on 5/16/2023 in #❓・help
Error after updated to 3.5
Hey everyone, ERROR Error while requiring module local: Error: Cannot find module 'local' 23:21:47 Require stack: - E:\project\client\index.js Node version: 18.16.0 Any suggestions?
4 replies
NNuxt
Created by SzaDave 👽 on 5/1/2023 in #❓・help
How to use different page (.vue) files for a Nuxt route depending on the client / server?
Hi everyone, I have a route for my products at '/product/[id]' and I want to implement a feature where if a user clicks on a product from the product listing, it should open in a modal (ProductModalPage.vue). However, if the user comes directly to the route from Google or types it into their browser, it should use another page file (ProductDirectPage.vue). I want to achieve this by checking if the process is running on the client or the server side. If it is running on the client, I want to use ProductModalPage.vue, and if it is running on the server, I want to use ProductDirectPage.vue. Shortened: Route: '/product/[id]' if (process.client) -> use "ProductModalPage.vue" // Maybe a nuxt child over the listing? if (process.server) -> use "ProductDirectPage.vue" Can you please suggest the best way to achieve this using Nuxt? Thank you!
1 replies
NNuxt
Created by SzaDave 👽 on 4/13/2023 in #❓・help
Need Help with Nuxt Middleware: Unexpected Behavior with navigateTo() Function
Hey everyone, I tried to implement an authentication flow to my Nuxt app, but I got stuck at the authentication middleware. When I use "return navigateTo('/')", the code after the middleware still runs. Is it normal for the navigateTo function to behave this way in a middleware?
<script setup>
definePageMeta({
middleware: [
function (to, from) {
console.log('middleware start')
return navigateTo('/')
},
],
})

console.log('this code should not running') // ...but running :(
</script>
<script setup>
definePageMeta({
middleware: [
function (to, from) {
console.log('middleware start')
return navigateTo('/')
},
],
})

console.log('this code should not running') // ...but running :(
</script>
If I use "return '/'" instead, it works as expected, but I'm not sure if this is a reliable solution:
<script setup>
definePageMeta({
middleware: [
function (to, from) {
console.log('middleware start')
return '/'
},
],
})

console.log('this code should not running') // Not running as expected
</script>
<script setup>
definePageMeta({
middleware: [
function (to, from) {
console.log('middleware start')
return '/'
},
],
})

console.log('this code should not running') // Not running as expected
</script>
8 replies