Adding URL queries to paths in Vue.js router: a step-by-step guide
P粉076987386
P粉076987386 2024-02-03 17:16:52
0
1
370

This is how to use routing in the template Component.vue:

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

This is how it is defined in router.js:

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

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

'?foo=bar'

I tried hardcoding it in Component.vue with no success. Should I define it as param in router.js or somewhere else?

P粉076987386
P粉076987386

reply all(1)
P粉232409069

Use this code:

go
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!