Skip to content

Commit ef0c72d

Browse files
decademoonyyx990803
authored andcommitted
Vue.prototype._init override should accept no args
1 parent 01123c4 commit ef0c72d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/override.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default function (Vue) {
55
// override Vue's init and destroy process to keep track of router instances
66
const init = Vue.prototype._init
77
Vue.prototype._init = function (options) {
8+
options = options || {}
89
const root = options._parent || options.parent || this
910
const route = root.$route
1011
if (route) {

test/unit/specs/core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ describe('Core', function () {
1111
spyOn(window, 'scrollTo')
1212
})
1313

14+
it('call Vue constructor with no arguments', function () {
15+
/* eslint-disable no-new */
16+
new Vue()
17+
/* eslint-enable no-new */
18+
})
19+
1420
it('matching views', function (done) {
1521
router = new Router({ abstract: true })
1622
router.map({

0 commit comments

Comments
 (0)