mirror of
https://github.com/flarum/framework.git
synced 2025-01-21 21:27:15 +08:00
common: modify Component#render to properly do what it is supposed to - modify the original instance
This commit is contained in:
parent
68c17f2c30
commit
3bf7f6f85b
|
@ -14,7 +14,7 @@ export default class Component<T extends ComponentProps = any> {
|
|||
props: T;
|
||||
|
||||
constructor(props: T = <T>{}) {
|
||||
this.props = props;
|
||||
this.props = props.tag ? <T>{} : props;
|
||||
}
|
||||
|
||||
view(vnode) {
|
||||
|
@ -65,7 +65,18 @@ export default class Component<T extends ComponentProps = any> {
|
|||
}
|
||||
|
||||
render() {
|
||||
return m(this, this.props);
|
||||
return m.fragment(
|
||||
{
|
||||
...this.props,
|
||||
oninit: (...args) => this.oninit(...args),
|
||||
oncreate: (...args) => this.oncreate(...args),
|
||||
onbeforeupdate: (...args) => this.onbeforeupdate(...args),
|
||||
onupdate: (...args) => this.onupdate.bind(...args),
|
||||
onbeforeremove: (...args) => this.onbeforeremove.bind(...args),
|
||||
onremove: (...args) => this.onremove.bind(...args),
|
||||
},
|
||||
this.view()
|
||||
);
|
||||
}
|
||||
|
||||
static component(props: ComponentProps | any = {}, children?: Mithril.Children) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user