Skip to content

Instantly share code, notes, and snippets.

@Bewitchedyegor
Created January 4, 2018 12:09
Show Gist options
  • Select an option

  • Save Bewitchedyegor/1e9c70d7760f9e42677829aafc754ade to your computer and use it in GitHub Desktop.

Select an option

Save Bewitchedyegor/1e9c70d7760f9e42677829aafc754ade to your computer and use it in GitHub Desktop.
Add hash to current link inside browser address bar without reloading the page
<template>
<a href="#cfd" @click="updateLink()">
</template>
<script>
export default {
methods: {
updateLink: function() {
var href = event.currentTarget.getAttribute('href');
history.pushState("", "", "cfd_products"+href);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment