mirror of
https://github.com/flarum/framework.git
synced 2025-05-22 14:49:57 +08:00
Give all components config on the root element
So that extensions can work on it no matter what
This commit is contained in:
@ -18,6 +18,10 @@ export default class Component {
|
|||||||
return selector ? $(this.element()).find(selector) : $(this.element());
|
return selector ? $(this.element()).find(selector) : $(this.element());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config(element, isInitialized, context, vdom) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -30,14 +34,15 @@ export default class Component {
|
|||||||
component.props = props;
|
component.props = props;
|
||||||
var vdom = component.view();
|
var vdom = component.view();
|
||||||
vdom.attrs = vdom.attrs || {};
|
vdom.attrs = vdom.attrs || {};
|
||||||
var oldConfig = vdom.attrs.config;
|
|
||||||
vdom.attrs.config = function() {
|
if (!vdom.attrs.config) {
|
||||||
var args = [].slice.apply(arguments);
|
vdom.attrs.config = function() {
|
||||||
component.element(args[0]);
|
var args = [].slice.apply(arguments);
|
||||||
if (oldConfig) {
|
component.element(args[0]);
|
||||||
oldConfig.apply(component, args);
|
component.config.apply(component, args);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return vdom;
|
return vdom;
|
||||||
};
|
};
|
||||||
view.$original = this.prototype.view;
|
view.$original = this.prototype.view;
|
||||||
|
Reference in New Issue
Block a user