diff --git a/framework/core/js/lib/component.js b/framework/core/js/lib/component.js index 379fc3ac9..0c41e2051 100644 --- a/framework/core/js/lib/component.js +++ b/framework/core/js/lib/component.js @@ -18,6 +18,14 @@ export default class Component { return selector ? $(this.element()).find(selector) : $(this.element()); } + onload(element) { + this.element(element); + } + + config() { + + } + /** */ @@ -28,7 +36,18 @@ export default class Component { } var view = function(component) { component.props = props; - return component.view(); + var vdom = component.view(); + vdom.attrs = vdom.attrs || {}; + if (!vdom.attrs.config) { + vdom.attrs.config = function() { + var args = [].slice.apply(arguments); + if (!args[1]) { + component.onload.apply(component, args); + } + component.config.apply(component, args); + } + } + return vdom; }; view.$original = this.prototype.view; var output = {