3.0.1
https://codepen.io/wrrrn/pen/GxqmOb
http://jsfiddle.net/7a31maev/1/
I've linked to what the current router code is. The issue is simple, so I hope I'm missing something obvious.
When the :paramOptional is set, and child route is pushed to, the path will look as such -
'/search/paramOne/paramOptional/paramTwo/show-modal'
When navigated to, the child removes the paramOptional. The resulting url is -
'/search/paramOne/paramTwo/show-modal'
Adding a this.$router.push({name:'ShowModal', params: {paramOptional: this. paramOptionalData}}) fixes the issue but makes me sad.
Edited to add an actual repro.
Thanks for writing this one up. I was just about ready to do it myself but found yours :)
I'm wanting to add an optional parameter at the start of my app (/admin?) to control some admin functionality. For now I'm just using your workaround on adding this in the params.
Let me know if I can help at all
you can work on a fix for this :)
I've created a PR for this :) https://github.com/vuejs/vue-router/pull/2538
@ElkeCodes Does this PR also work for this use case?
/search/:a/(test/:b)?/:c
http://jsfiddle.net/wf517tdu/1/
Most helpful comment
Adding a
this.$router.push({name:'ShowModal', params: {paramOptional: this. paramOptionalData}})fixes the issue but makes me sad.