New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
help: Access additional Route Information #16
Comments
I'm also interested in a solution, as with nuxt rc5 window.$nuxt was removed and this workaround doesn't work anymore. Did you find a different solution @aaronksaunders? Edit: I found a different workaround, but I don't know if it is a proper solution to use vue-router: import { useRouter } from 'vue-router'
const { currentRoute } = useRouter()
const id = currentRoute.value.params.id |
$nuxt.config.globalProperties.$router?.currentRoute; will get you access to the route |
You could also just directly get current route (worked for me) import { useRoute } from 'vue-router'
const route = useRoute() One thing to point out would be that even tho ionic has it's own implementation of the router, it doesn't include any info about current route import { useIonRouter } from '@ionic/vue'
const router = useIonRouter()
router.currentRoute // Doesn't exist... It might be an oversight, but I guess this implementation should only be used for pushing or replacing new routes |
@Lexpeartha that is what I use the workaround mentioned here... to get all of the route information |
馃摎 What are you trying to do?
I need the information from the route to find the active link; since we are not using NuxtLink. I needed to hack into the configuration to get the information and was wondering if there is an easier way?
馃攳 What have you tried?
This works, but wondering if there is a cleaner way, when I call
useIonicRouter
it doesn't have the additional route information鈩癸笍 Additional context
See example code here
https://stackblitz.com/edit/nuxt-starter-rqvhxt?file=components%2FMainMenu.vue
The text was updated successfully, but these errors were encountered: