1

In my vue application I need an optional router like this

#/profile/(:user/)?task/current-task

Here I want user will be optional. if user not exit then I want to show current login user task. I know #/profile/(:user/)? it possible. But having children after an optional params not working for me. any suggestion?

Shahadat Hossain
  • 947
  • 9
  • 24
  • 1
    Possible duplicate of [Optional param in vuejs router](https://stackoverflow.com/questions/47824660/optional-param-in-vuejs-router) – Jacob Goh May 15 '18 at 02:57

1 Answers1

1

It's possible

You can define #/profile/:user?/task/current-task

Demo

http://jsfiddle.net/29jvk913/

More nested params

http://jsfiddle.net/y3kbovhy/

ittus
  • 21,730
  • 5
  • 57
  • 57
  • Right now I have such problem when my route end on optional params it removes from when you route in search for example ( /root/:id?) this works. But when you add path after optional params it doesn't remove anything (/root/:id?/example). Can you explain why this happening? How to make always removable? – Dave Jun 23 '18 at 17:37