1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +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
*/
export default class Page extends Component {
init() {
oninit(vnode) {
super.oninit(vnode);
app.previous = app.current;
app.current = new PageState(this.constructor);
@@ -22,13 +24,17 @@ export default class Page extends Component {
this.bodyClass = '';
}
config(isInitialized, context) {
if (isInitialized) return;
oncreate(vnode) {
super.oncreate(vnode);
if (this.bodyClass) {
$('#app').addClass(this.bodyClass);
}
}
context.onunload = () => $('#app').removeClass(this.bodyClass);
onremove() {
if (this.bodyClass) {
$('#app').removeClass(this.bodyClass);
}
}
}