AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Copied links in hash mode don't have a # #65

Closed gereleth closed 3 years ago

gereleth commented 3 years ago

I initialized an app from svelte template, installed tinro and put the following into App.svelte:

<script>
  import {Route, router} from 'tinro';
  router.mode.hash();
</script>
<nav>
  <a href="/">Index</a>
  <a href="/foo">Foo</a>
</nav>
<main>
  <Route path="/">Index</Route>
  <Route path="/foo">Foo</Route>
</main>

Clicking on navigation links works fine, and I see correct hash-based links in the address bar. However, if I right-click a link to Foo and copy link location then I get a url without #: http://localhost:5000/foo instead of http://localhost:5000/#/foo.

So copying a link and pasting it into the address bar gives an error. Is there a way to make link copy-pasting work?

AlexxNB commented 3 years ago

You might write href="/#/foo" if you want to support ability of links copying.

gereleth commented 3 years ago

Ok, that works! Thanks for the help =).