mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
436 B
24 lines
436 B
7 years ago
|
<a href="#" use:link>Test</a>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
actions: {
|
||
|
link(node) {
|
||
|
|
||
|
function onClick(event) {
|
||
|
event.preventDefault();
|
||
|
history.pushState(null, null, event.target.href);
|
||
|
}
|
||
|
|
||
|
node.addEventListener('click', onClick);
|
||
|
|
||
|
return {
|
||
|
destroy() {
|
||
|
node.removeEventListener('click', onClick);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|