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 "_.vue" with Dynamic route parameters #1400

Closed
JeremDigi opened this issue Feb 17, 2022 · 1 comment
Closed

How to use "_.vue" with Dynamic route parameters #1400

JeremDigi opened this issue Feb 17, 2022 · 1 comment

Comments

@JeremDigi
Copy link

Hello !

Here is my structure:

pages
-> index.vue
-> _.vue
-> posts (folder)
---> _slug.vue

When I use this to translate the dynamic routes of my posts, it works :

async asyncData({ $sanity, route, error, app, store }) {
        await store.dispatch('i18n/setRouteParams', {
            en: { slug: 'my-post' },
            fr: { slug: 'mon-article' }
        })
}

But when I try to translate all other routes (which are not in a folder, thanks to _.vue), it doesn't work.

await store.dispatch('i18n/setRouteParams', {
      en: { _: 'my-great-page' },
      fr: { _: 'ma-super-page' }
})

I need to use _.vue because some of my slugs are like this: page-1/my-subpage-1

It's possible?

Thank you

@rchl
Copy link
Collaborator

rchl commented Feb 19, 2022

It needs to be pathMatch. I've added info about that to docs b6039d2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants