1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 10:55:47 +02:00

update: common/components.Page.js

This commit is contained in:
Matthew Kilgore
2020-08-07 20:45:59 -04:00
committed by Franz Liedke
parent 4fcafe3b2f
commit 5f0dcc71ba

View File

@@ -7,7 +7,9 @@ import PageState from '../states/PageState';
* @abstract * @abstract
*/ */
export default class Page extends Component { export default class Page extends Component {
init() { oninit(vnode) {
super.oninit(vnode);
app.previous = app.current; app.previous = app.current;
app.current = new PageState(this.constructor); app.current = new PageState(this.constructor);
@@ -22,13 +24,17 @@ export default class Page extends Component {
this.bodyClass = ''; this.bodyClass = '';
} }
config(isInitialized, context) { oncreate(vnode) {
if (isInitialized) return; super.oncreate(vnode);
if (this.bodyClass) { if (this.bodyClass) {
$('#app').addClass(this.bodyClass); $('#app').addClass(this.bodyClass);
}
}
context.onunload = () => $('#app').removeClass(this.bodyClass); onremove() {
if (this.bodyClass) {
$('#app').removeClass(this.bodyClass);
} }
} }
} }