Skip to content

Commit 2ddcae6

Browse files
author
Evan You
committed
fix #172 parent option in Vue.extend
1 parent 5eddfd0 commit 2ddcae6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/compiler.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@ CompilerProto.createBinding = function (key, directive) {
576576
// nested path on computed property
577577
compiler.defineExp(key, binding)
578578
} else {
579-
// ensure path in data so it can be observed
579+
// ensure path in data so that computed properties that
580+
// access the path don't throw an error and can collect
581+
// dependencies
580582
Observer.ensurePath(compiler.data, key)
581583
var parentKey = key.slice(0, key.lastIndexOf('.'))
582584
if (!bindings[parentKey]) {

src/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ function inheritOptions (child, parent, topLevel) {
173173
} else {
174174
child[key].push(parentVal)
175175
}
176-
} else if (topLevel && (type === 'Object' || parentType === 'Object')) {
176+
} else if (
177+
topLevel &&
178+
(type === 'Object' || parentType === 'Object')
179+
&& !(parentVal instanceof ViewModel)
180+
) {
177181
// merge toplevel object options
178182
child[key] = inheritOptions(val, parentVal)
179183
} else if (val === undefined) {

0 commit comments

Comments
 (0)