I'm currently working on an app with multiple dropdown components that affect the state of a main datatable based on selected parameters. It's cool how everything ties together.
Now, I want to enhance user experience by allowing them to share URLs with their colleagues so that when opened, the shared URL will directly display the relevant data in the datatable without requiring them to select dropdown parameters manually.
For instance: http://localhost:8080/?region=372&pc=341&pc=375 or http://localhost:8080/?region=372&pc=341&vendor=123456
Currently, I have managed to achieve this functionality by watching for changes in the dropdown parameters using watch
, constructing the URL dynamically, and utilizing this.$router.push
to update the browser history whenever there's a change. While this approach works reliably, I suspect it might not be entirely correct.
However, the major issue arises when I use the browser's back/forward buttons - the components don't update their states based on the URL. Instead, the application retains its current state regardless of navigating through the browser history. How can I address this issue effectively?