fix #172 `parent` option in Vue.extend

This commit is contained in:
Evan You 2014-03-12 11:35:56 -04:00
parent 5eddfd0514
commit 2ddcae6044
2 changed files with 8 additions and 2 deletions

View File

@ -576,7 +576,9 @@ CompilerProto.createBinding = function (key, directive) {
// nested path on computed property
compiler.defineExp(key, binding)
} else {
// ensure path in data so it can be observed
// ensure path in data so that computed properties that
// access the path don't throw an error and can collect
// dependencies
Observer.ensurePath(compiler.data, key)
var parentKey = key.slice(0, key.lastIndexOf('.'))
if (!bindings[parentKey]) {

View File

@ -173,7 +173,11 @@ function inheritOptions (child, parent, topLevel) {
} else {
child[key].push(parentVal)
}
} else if (topLevel && (type === 'Object' || parentType === 'Object')) {
} else if (
topLevel &&
(type === 'Object' || parentType === 'Object')
&& !(parentVal instanceof ViewModel)
) {
// merge toplevel object options
child[key] = inheritOptions(val, parentVal)
} else if (val === undefined) {