Skip to content

Commit

Permalink
feat(warn): warn deprecated addRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 5, 2021
1 parent 92395d4 commit 2e41445
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { install } from './install'
import { START } from './util/route'
import { assert } from './util/warn'
import { assert, warn } from './util/warn'
import { inBrowser } from './util/dom'
import { cleanPath } from './util/path'
import { createMatcher } from './create-matcher'
Expand Down Expand Up @@ -256,6 +256,9 @@ export default class VueRouter {
}

addRoutes (routes: Array<RouteConfig>) {
if (process.env.NODE_ENV !== 'production') {
warn(false, 'router.addRoutes() is deprecated and has been removed in Vue Router 4. Use router.addRoute() instead.')
}
this.matcher.addRoutes(routes)
if (this.history.current !== START) {
this.history.transitionTo(this.history.getCurrentLocation())
Expand Down

2 comments on commit 2e41445

@maicWorkGithub
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deprecate addRouters? I cannot find any comment in changelog or disscussion in issue

@lebronxie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do wonder why

Please sign in to comment.