Skip to content

Programmatic navigation does not work with "zero or more" route matching #1175

Open
@nicbou

Description

@nicbou

Vue.js / vue-router versions

2.1.1

Steps to reproduce

  • Create a route that uses a "zero or more" operator: '/directions/:itineraryItems(.*)*'
  • Access this route with a matching URL: /directions/origin/destination
  • Access this route programmatically:
    router.push({
      name: 'directions',
      params: {
        itineraryItems: ['origin', 'destination']
      }
    })

What is Expected?

The parsed itineraryItems route param is an array containing 'origin' and 'destination'.

What is actually happening?

The parsed itineraryItems route param is a string with the value 'origin/destination' if the URL is accessed directly.

The parsed itineraryItems route param is an array containing 'origin' and 'destination' if accessed programmatically.

This means the same URL can have its params as an array or as a string, depending on how it was created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed on 4.xThis issue has been already fixed on the v4 but exists in v3improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions