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:
committed by
Franz Liedke
parent
4fcafe3b2f
commit
5f0dcc71ba
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user