[Vuejs]-How to navigate Programmatically in Vue.js with added Hash

0👍

Judging by the examples, you are trying to pass a hash through params, but in the configuration you indicate that a parameter is expected. If you want to pass exactly the hash, then here’s an example:

openSettingsPage(hash) {
  return this.$router.push({ name: 'Settings', hash })
}

If as a parameter:

openSettingsPage(hash) {
  return this.$router.push({ name: 'Settings', params: { hash } })
}

Hash and params are different things. Read the documentation and decide what works best for you.

And you also didn’t include a slash before the parameter:

{
  path: '/settings/profile/:hash',
  name: 'Settings',
  component: Settings,
}

Leave a comment