A
A
Andy Oker2021-12-02 11:22:44
Vue.js
Andy Oker, 2021-12-02 11:22:44

How to make a named jump with a slash at the end?

There is component A and B:

{
    path: '/:name1?/:name2?/',
    name: A,
    ...
},
{
    path: '/:name/',
    name: B,
    ...
}

router.push({name: 'B', params: {name: 'test'}})- Such a redirect will work, but without the slash at the end.
router.push({path: '/test/')- and this will add a slash, but will not go to component B

How can this slash be added when moving from A to B with such an implementation of the paths of these components in the router?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2021-12-02
@Ashlis

jsfiddle.net/L7hscd8h/9377
pathToRegexpOptions: { strict: true }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question