I want to bind a dropdown to a query parameter in the URL, so
- when opening
/page?dropdown=foo
, I want the dropdown to havefoo
pre-selected - and the other way round: when changing the dropdown’s value to
bar
, to have the URL rewritten into/page?dropdown=bar
.
My question now:
Is there an out-of-the-box way to tell vue-router to data-bind this?
Or do I need to do it by hand, so when entering/changing the route, setting the dropdown’s value and using a :onchange
on the dropdown to call router.replace()
?