Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use params with vue-i18n-routing? #89

Open
bbauti opened this issue Mar 19, 2024 · 0 comments
Open

How to use params with vue-i18n-routing? #89

bbauti opened this issue Mar 19, 2024 · 0 comments

Comments

@bbauti
Copy link

bbauti commented Mar 19, 2024

Hi! I need to pass props to a route, but to do it I need to use the name of the route, and the library modifies it.

I tried to use localeLocation, and when running it inside a template it works correctly.
My problem is that I need it to work inside the script block (I'm using vue3 with composition api, and the script setup syntax).

When using the function localeLocation inside the script, it tells me that it does not exist, when importing it (which I do not need to do when using it inside the template) and running the function it returns me that it cant find 'router', but I can not pass it to the function.
What can I do to be able to use parameters with this library?

My project is configured like the playground vue3 project

<script setup lang="ts">
// Does not work
console.log(localeLocation({ name: 'about', params: { test: 'hola' } } ))
</script>

<template>
  <!-- Does work -->
  <pre>{{ localeLocation({ name: 'about', params: { test: 'hola' } }) }}</pre>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant