Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue-router 3.1.x breaking change #3016

Closed
bigreddale opened this issue Nov 2, 2019 · 2 comments

Comments

@bigreddale
Copy link

@bigreddale bigreddale commented Nov 2, 2019

Version

3.1.3

Reproduction link

https://jsfiddle.net/u7vwcaLm/7/

Steps to reproduce

Create a router-link with a to attribute that is a static string and wrap it around a child element (or elements) instead of using v-html

What is expected?

The router-link should render as an a tag with a correct href attribute and clicking the link should navigate through the router to the desired route.

Eg. Same code using router v3.0.7
https://jsfiddle.net/u7vwcaLm/8/

What is actually happening?

The child elements are being rendered without the wrapping a tag. Note that About is not a link. In the example with router 3.0.7 About is correctly wrapped in an a tag that routes correctly on click.


I love the additional power added in the 3.1.0 update but please fix this breaking change.

@bigreddale

This comment has been minimized.

Copy link
Author

@bigreddale bigreddale commented Nov 2, 2019

I THINK this can be resolved with an additional check at https://github.com/vuejs/vue-router/blob/dev/src/components/link.js#L92

Adding:
this['v-slot'] &&

Would verify that the developer is attempting to leverage the new scoped slot functionality.

Otherwise the example above evaluates as a scoped slot and falls into
https://github.com/vuejs/vue-router/blob/dev/src/components/link.js#L104 and is simply returned without a link around it.

@posva

This comment has been minimized.

Copy link
Member

@posva posva commented Nov 2, 2019

You are using an outdated version of vue, you should updated it alongside vue-router. There were quite a few v-slot related fixes between 2.6.6 and 2.6.9 (that version makes it work)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.