Skip to content

Add support for custom history implementations #2052

Open
@ardoramor

Description

@ardoramor

What problem does this feature solve?

This feature would address many requests seen in relation to having greater control over applications history, stack management, initial route, and a few others.

There are several supported history modes. My proposal is to allow mode option accept an instance of a class that implements History API.

Instantiation would look like:

import { AbstractHistory } from 'vue-router'

class CustomHistory extends AbstractHistory {
   ...
}

const customHistory = new CustomHistory()

const router = new VueRouter({
  mode: customHistory,
  routes: [...]
})

This would give great flexibility to developers and would allow further integrations of cool features such as keeping reactive history with vuex.

What does the proposed API look like?

mode option would accept String or an instance of AbstractHistory. Internally, if an instance is detected, the history manipulation would happen through it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestfixed on 4.xThis issue has been already fixed on the v4 but exists in v3needs RFCThis feature request needs to go through the RFC process to gather more information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions