mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
fix(vue-app): set push
on router instance rather than prototype (#8523)
resolves #7479 resolves #8522
This commit is contained in:
parent
b06df71753
commit
8c8793073f
@ -83,12 +83,7 @@ const _routes = recursiveRoutes(router.routes, ' ', _components, 1)
|
||||
}
|
||||
}).join('\n')%>
|
||||
|
||||
// TODO: remove in Nuxt 3
|
||||
const emptyFn = () => {}
|
||||
const originalPush = Router.prototype.push
|
||||
Router.prototype.push = function push (location, onComplete = emptyFn, onAbort) {
|
||||
return originalPush.call(this, location, onComplete, onAbort)
|
||||
}
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
@ -117,6 +112,12 @@ function decodeObj(obj) {
|
||||
export function createRouter () {
|
||||
const router = new Router(routerOptions)
|
||||
|
||||
// TODO: remove in Nuxt 3
|
||||
const originalPush = router.push
|
||||
router.push = function push (location, onComplete = emptyFn, onAbort) {
|
||||
return originalPush.call(this, location, onComplete, onAbort)
|
||||
}
|
||||
|
||||
const resolve = router.resolve.bind(router)
|
||||
router.resolve = (to, current, append) => {
|
||||
if (typeof to === 'string') {
|
||||
|
Loading…
Reference in New Issue
Block a user