|
|
@@ -139,12 +139,12 @@ export default {
|
|
|
// actual mount
|
|
|
this.unbuild(true)
|
|
|
var self = this
|
|
|
- var activateHook = this.Component.options.activate
|
|
|
+ var activateHooks = this.Component.options.activate
|
|
|
var cached = this.getCached()
|
|
|
var newComponent = this.build()
|
|
|
- if (activateHook && !cached) {
|
|
|
+ if (activateHooks && !cached) {
|
|
|
this.waitingFor = newComponent
|
|
|
- activateHook.call(newComponent, function () {
|
|
|
+ callActivateHooks(activateHooks, newComponent, function () {
|
|
|
if (self.waitingFor !== newComponent) {
|
|
|
return
|
|
|
}
|
|
|
@@ -358,3 +358,24 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Call activate hooks in order (asynchronous)
|
|
|
+ *
|
|
|
+ * @param {Array} hooks
|
|
|
+ * @param {Vue} vm
|
|
|
+ * @param {Function} cb
|
|
|
+ */
|
|
|
+
|
|
|
+function callActivateHooks (hooks, vm, cb) {
|
|
|
+ var total = hooks.length
|
|
|
+ var called = 0
|
|
|
+ hooks[0].call(vm, next)
|
|
|
+ function next () {
|
|
|
+ if (++called >= total) {
|
|
|
+ cb()
|
|
|
+ } else {
|
|
|
+ hooks[called].call(vm, next)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|