0
I’m using the vue/router
to make a spa, and I’m having difficulty sending the id of a particular product by the url...
I’m doing so on the link:
<router-link :to="{name:'editar',params:{id:item.id}}">editar2</router-link>
route:
const routes = [{
path: '/',
component: Vue.component('home-page')
}, {
path: '/teste',
component: Vue.component('home-page')
}, {
path: '/editar',
'name': editar,
component: Vue.component('home-page')
}]
const myRouter = new VueRouter({
routes
})
but it doesn’t work at all... url
?
How you set your route?
– Marconi
the route file is configured like this: const Routes=[ { path:'/', Component: Vue.Component('home-page') }, { path:'/test', Component: Vue.Component('home-page') }, { path:'/edit','name':edit, Component: Vue.Component('home-page') } ] constmyR = outer new Vuerouter({Routes})
– Horacio Neto
try:
{
 path: '/editar:id',
 'name': editar,
 component: Vue.component('home-page')
}
– Marconi
so the problem is the link...it does not send parameters
– Horacio Neto
<router-link to='
/edit/${id:item.id}'>editar2</router-link>
– Marconi
it was not yet...gave error because of $ (I am not working with Node.js is a simple application) removing the $ too, it did not work
– Horacio Neto
Let’s go continue this discussion in chat.
– Horacio Neto