what is a way to change the route based on the selected option or also show the default selected option in a select element?

I ended up solving the issue by adding the following within the component export:

  created() {
    // Make sure the correct option is shown on load
    this.accountMenuOption = this.$router.history.current.fullPath;
  },
  watch: {
    // Watch for route changes
    $route(route) {
      // Change the value of the selected option
      this.accountMenuOption = route.path;
    },
  },

I’m new to Vue, so not sure why exactly this solves my problem, but it does. If anyone wants to explain, feel free to.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top