Skip to content

Hash value not hash in history mode #2778

Closed
@bytesnz

Description

@bytesnz

When passing a hash value as a property in a Location Object in the to attribute of a router-link, there is no hash in the generated url when vue-router is in history mode.

Version

3.0.6

Reproduction link

https://codesandbox.io/s/vuedynamiccomponents-4hdqp
The Home link shows the issue

<router-link :to="{ name: 'Home', hash: 'test' }">Home</router-link>

creates the url /test instead of /#test

Steps to reproduce

  1. Setup app with routes
  2. Create a link with router-link using an Object with a hash value for the :to attribute
  3. Run app and try clicking on link

What is expected?

Link should be produced with a hash separating the hash, eg /link/to/route#hash

What is actually happening?

No hash separating hash, eg /link/to/routehash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions