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

vue2 router state change router.addRoutes #1341

Closed
codedart2018 opened this issue Apr 15, 2017 · 7 comments
Closed

vue2 router state change router.addRoutes #1341

codedart2018 opened this issue Apr 15, 2017 · 7 comments

Comments

@codedart2018
Copy link

Version

2.2.0

Reproduction link

https://github.com/myxingke/vueManage.git

Steps to reproduce

Not landed router Array
[{xxxx}, {xxxx}, {xxxx},{'path': '*'}]
notice {'path':‘*’}

login code
let routes = sessionRoutes(res.data.menu) for( let [ index, route ] of new Map( routes.map( ( item, i ) => [ i, item ] ) ) ) { let key = this.$router.options.routes.length-1 this.$router.options.routes.splice(key, 0, route) } this.$router.addRoutes(routes)
result router Array
[{xxxx}, {xxxx}, {xxxx},{new router},{new router},{'path': '*'}]

What is actually happening?
But that's it
[{xxxx}, {xxxx}, {xxxx},{'path': '*'},{new router},{new router}]
notice ,{'path': '*'}

When I click on the new page, it appears behind {'path': '*'}. This is not the result I want。I hope one is one

I Hope

It is it [{xxxx}, {xxxx}, {xxxx},{new router},{new router},{'path': '*'}]
Not it [{xxxx}, {xxxx}, {xxxx},{'path': '*'},{new router},{new router}]

What is expected?

[{xxxx}, {xxxx}, {xxxx},{new router},{new router},{'path': '*'}]

What is actually happening?

But that's it
[{xxxx}, {xxxx}, {xxxx},{'path': '*'},{new router},{new router}]


Not landed router Array
[{xxxx}, {xxxx}, {xxxx},{'path': '*'}]
notice {'path':‘*’}

login code
let routes = sessionRoutes(res.data.menu) for( let [ index, route ] of new Map( routes.map( ( item, i ) => [ i, item ] ) ) ) { let key = this.$router.options.routes.length-1 this.$router.options.routes.splice(key, 0, route) } this.$router.addRoutes(routes)
result router Array
[{xxxx}, {xxxx}, {xxxx},{new router},{new router},{'path': '*'}]

What is actually happening?
But that's it
[{xxxx}, {xxxx}, {xxxx},{'path': '*'},{new router},{new router}]
notice ,{'path': '*'}

When I click on the new page, it appears behind {'path': '*'}. This is not the result I want。I hope one is one

I Hope

It is it [{xxxx}, {xxxx}, {xxxx},{new router},{new router},{'path': '*'}]
Not it [{xxxx}, {xxxx}, {xxxx},{'path': '*'},{new router},{new router}]

Or else is the meaning of dynamic routing?

@LinusBorg
Copy link
Member

This was fixed with this commit:

0fed200

The fix will be in the next release

@codedart2018
Copy link
Author

@LinusBorg Really? What's the next version?

@LinusBorg
Copy link
Member

The one that is not released yet.

@codedart2018
Copy link
Author

@LinusBorg I think I say it in Chinese:太J2感谢你了。

@codedart2018
Copy link
Author

@LinusBorg I want to add addRoutes appendRoutes replaceRoutes deleteRoutes

@LinusBorg
Copy link
Member

LinusBorg commented Apr 16, 2017

replaceRoutes deleteRoutes
that would be a new feature request.

@codedart2018
Copy link
Author

@LinusBorg I anticipate. hei hei hei

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants