fix v-el/v-ref owner locating

This commit is contained in:
Evan You 2014-09-15 22:52:49 -04:00
parent 0c1e4fce2f
commit 8725ea32d2
3 changed files with 9 additions and 13 deletions

View File

@ -3,12 +3,11 @@ module.exports = {
isLiteral: true,
bind: function () {
this.owner = this.vm._owner || this.vm
this.owner.$$[this.expression] = this.el
this.vm._owner.$$[this.expression] = this.el
},
unbind: function () {
this.owner.$$[this.expression] = null
this.vm._owner.$$[this.expression] = null
}
}

View File

@ -11,12 +11,11 @@ module.exports = {
)
return
}
this.owner = this.vm._owner || this.vm
this.owner.$[this.expression] = this.vm
this.vm._owner.$[this.expression] = this.vm
},
unbind: function () {
this.owner.$[this.expression] = null
this.vm._owner.$[this.expression] = null
}
}

View File

@ -53,14 +53,12 @@ exports._init = function (options) {
// anonymous instances are created by v-if
// we need to walk along the parent chain to locate the
// first non-anonymous instance as the owner.
var anon = this._isAnonymous = options._anonymous
if (anon) {
var parent = this.$parent
while (parent._isAnonymous) {
parent = parent.$parent
}
this._owner = parent
this._isAnonymous = options._anonymous
var parent = this.$parent
while (parent && parent._isAnonymous) {
parent = parent.$parent
}
this._owner = parent
// merge options.
options = this.$options = mergeOptions(