javascript - How to pass a string containing slash ('/') as parameter to a route in vue.js -
this question has answer here:
- slashes in url variables 3 answers
i using vue router , have route
{ path: '/my-route/:param?', component: mycomponent }
i have link route as
<router-link :to="'/my-route/'+myparam">link text</router-link>
if myparam
string containing '/'
'abc/def'
, navigates link /my-route/abc/def
doesn't exists. how solve this?
you have encode url javascript function encodeuricomponent(uri)
update router-link
<router-link :to="'/my-route/'+encodeuricomponent(myparam)">link text</router-link>
Comments
Post a Comment