oskca / gopherjs-vue

VueJS bindings for gopherjs
MIT License
149 stars 17 forks source link

Question about NewComponent and multiple invocations of the model constructor vmCreator per component instance #1

Closed theclapp closed 7 years ago

theclapp commented 8 years ago

In component.go, NewComponent has a closure called vmfn, which calls the vmCreator function every third time it (vmfn) is invoked. The intent seems to be call vmCreator once for each instance of the given component.

As near as I can tell, vmfn is called four times per component.

Is there a mismatch going on somewhere, or have I missed something, or what?

Thanks for this package!

theclapp commented 8 years ago

vmCreator is called twice in the "init" lifecycle event, and then twice in Vue.prototype._initData, once as dataFn() and once as this._runtimeData().

oskca commented 7 years ago

yes, the multiple invocation of vmfn is on purpose for vue.GetVM to work in components