A
A
antimodern2019-01-19 20:31:35
Vue.js
antimodern, 2019-01-19 20:31:35

Why is trailing slash added?

:to="{name: 'slug', params: {slug: article.slug}}"

adds a slash

http://example.com/qui-in-similique-necessitatibus-est/


while doing everything right

:to="article.slug"

http://example.com/qui-in-similique-necessitatibus-est

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Khokhlov, 2019-01-20
@andrhohlov

In the first case, the router generates the URL itself, and adds a slash at the end. More details https://github.com/vuejs/vue-router/issues/1273
In the second case, it doesn't form anything, it uses what you passed in toas is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question