mirror of
https://github.com/flarum/core.git
synced 2025-08-03 23:17:43 +02:00
Update admin's page.tsx
This commit is contained in:
committed by
David Sevilla Martín
parent
c6062019c5
commit
a344319dde
@@ -2,31 +2,33 @@ import Component from '../../common/Component';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Page` component
|
* The `Page` component
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
export default class Page extends Component {
|
export default abstract class Page extends Component {
|
||||||
init() {
|
/**
|
||||||
|
* A class name to apply to the body while the route is active.
|
||||||
|
*/
|
||||||
|
bodyClass: string = '';
|
||||||
|
|
||||||
|
oninit(vnode) {
|
||||||
|
super.oninit(vnode);
|
||||||
|
|
||||||
|
if (this.bodyClass) {
|
||||||
|
$('#app').addClass(this.bodyClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oncreate(vnode) {
|
||||||
|
super.oncreate(vnode);
|
||||||
|
|
||||||
app.previous = app.current;
|
app.previous = app.current;
|
||||||
app.current = this;
|
app.current = this;
|
||||||
|
|
||||||
app.modal.close();
|
app.modal.close();
|
||||||
|
|
||||||
/**
|
|
||||||
* A class name to apply to the body while the route is active.
|
|
||||||
*
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
this.bodyClass = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config(isInitialized, context) {
|
onremove(vnode) {
|
||||||
if (isInitialized) return;
|
super.onremove(vnode);
|
||||||
|
|
||||||
if (this.bodyClass) {
|
$('#app').removeClass(this.bodyClass);
|
||||||
$('#app').addClass(this.bodyClass);
|
|
||||||
|
|
||||||
context.onunload = () => $('#app').removeClass(this.bodyClass);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user