vendor/assets/javascripts/bower/vue/src/directives/component.js in fluentd-ui-0.3.9 vs vendor/assets/javascripts/bower/vue/src/directives/component.js in fluentd-ui-0.3.10
- old
+ new
@@ -1,7 +1,6 @@
var _ = require('../util')
-var compile = require('../compiler/compile')
var templateParser = require('../parsers/template')
module.exports = {
isLiteral: true,
@@ -28,16 +27,10 @@
// cache object, with its constructor id as the key.
this.keepAlive = this._checkParam('keep-alive') != null
if (this.keepAlive) {
this.cache = {}
}
- // compile parent scope content
- this.parentLinkFn = compile(
- this.el, this.vm.$options,
- true, // partial
- true // asParent
- )
// if static, build right now.
if (!this._isDynamicLiteral) {
this.resolveCtor(this.expression)
this.childVM = this.build()
this.childVM.$before(this.ref)
@@ -81,18 +74,14 @@
}
}
var vm = this.vm
var el = templateParser.clone(this.el)
if (this.Ctor) {
- var parentUnlinkFn
- if (this.parentLinkFn) {
- parentUnlinkFn = this.parentLinkFn(vm, el)
- }
var child = vm.$addChild({
- el: el
+ el: el,
+ _asComponent: true
}, this.Ctor)
- child._parentUnlinkFn = parentUnlinkFn
if (this.keepAlive) {
this.cache[this.ctorId] = child
}
return child
}
@@ -106,13 +95,10 @@
unbuild: function () {
var child = this.childVM
if (!child || this.keepAlive) {
return
}
- if (child._parentUnlinkFn) {
- child._parentUnlinkFn()
- }
// the sole purpose of `deferCleanup` is so that we can
// "deactivate" the vm right now and perform DOM removal
// later.
child.$destroy(false, true)
},
@@ -199,14 +185,10 @@
unbind: function () {
this.unbuild()
// destroy all keep-alive cached instances
if (this.cache) {
for (var key in this.cache) {
- var child = this.cache[key]
- if (child._parentUnlinkFn) {
- child._parentUnlinkFn()
- }
- child.$destroy()
+ this.cache[key].$destroy()
}
this.cache = null
}
}
\ No newline at end of file