mirror of https://github.com/vuejs/vue.git
fix v-el/v-ref owner locating
This commit is contained in:
parent
0c1e4fce2f
commit
8725ea32d2
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in New Issue