|
|
@@ -133,6 +133,14 @@ exports._destroy = function (remove, deferCleanup) {
|
|
|
var parent = this.$parent
|
|
|
if (parent && !parent._isBeingDestroyed) {
|
|
|
parent.$children.$remove(this)
|
|
|
+ // unregister ref
|
|
|
+ var ref = this.$options._ref
|
|
|
+ if (ref) {
|
|
|
+ var scope = this._scope || this._context
|
|
|
+ if (scope.$refs[ref] === this) {
|
|
|
+ scope.$refs[ref] = null
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// remove self from owner fragment
|
|
|
if (this._frag) {
|
|
|
@@ -156,14 +164,6 @@ exports._destroy = function (remove, deferCleanup) {
|
|
|
while (i--) {
|
|
|
this._watchers[i].teardown()
|
|
|
}
|
|
|
- // unregister ref
|
|
|
- var ref = this.$options._ref
|
|
|
- if (ref) {
|
|
|
- var scope = this._scope || this._context
|
|
|
- if (scope.$refs[ref] === this) {
|
|
|
- scope.$refs[ref] = null
|
|
|
- }
|
|
|
- }
|
|
|
// remove reference to self on $el
|
|
|
if (this.$el) {
|
|
|
this.$el.__vue__ = null
|