0

This is how the route is used in template Component.vue:

<router-link :to="{ name: 'club' }">
  <lazy-image
    src="club.jpg"
    class="club_class"
    alt="Club alt"
  />
</router-link>

And this is how it's defined in router.js:

const routes = [
    {
        path: '/s/site',
        name: 'club',
        component: () => import('./_pages/Club'),
    },
];
export default routes;

I need to add a just a static parameter to the link like this:

'?foo=bar'

I tried to hardcode that in Component.vue but it didn't work. Shoud I define it in router.js as param or somewhere else?

1
  • 1
    :to="{ name: 'club', query:{ foo: 'bar' } }" Commented Apr 20, 2022 at 15:16

1 Answer 1

1

Use this code:

<router-link :to="{name: 'club', query: {param1: 'value1', param2: 'value2'}}">go</router-link>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.