fix(core): update

This commit is contained in:
Philipp Kunz 2020-07-15 21:00:47 +00:00
parent 0ce9a96b90
commit 08d92d9d3e
2 changed files with 19 additions and 17 deletions

View File

@ -37,19 +37,6 @@ export class WccDashboard extends LitElement {
if (pagesArg) {
this.pages = pagesArg;
}
this.init();
}
public async init() {
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.domtools.router.on('/elements/:elementName', async routeInfo => {
this.selectedItem = this.elements[routeInfo.params.elementName];
});
this.domtools.router.on('/pages/:pageName', async routeInfo => {
this.selectedItem = this.pages[routeInfo.params.pageName];
});
this.domtools.router._handleRouteState();
}
public render(): TemplateResult {
@ -122,4 +109,16 @@ export class WccDashboard extends LitElement {
}, 0);
}
}
public async firstUpdated() {
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.domtools.router.on('/elements/:elementName', async routeInfo => {
this.selectedItem = this.elements[routeInfo.params.elementName];
});
this.domtools.router.on('/pages/:pageName', async routeInfo => {
this.selectedItem = this.pages[routeInfo.params.pageName];
});
this.domtools.router._handleRouteState();
}
}

View File

@ -1,3 +1,4 @@
import * as plugins from '../wcctools.plugins';
import { LitElement, property, html, customElement, TemplateResult } from 'lit-element';
import { WccDashboard } from './wcc-dashboard';
@ -104,9 +105,10 @@ export class WccSidebar extends LitElement {
return html`
<div
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
@click=${() => {
@click=${async () => {
const domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.selectItem(item);
this.dashboardRef.domtools.router.pushUrl(`/pages/${pageName}`);
domtools.router.pushUrl(`/pages/${pageName}`);
}}
>
<i class="material-icons">insert_drive_file</i>
@ -123,9 +125,10 @@ export class WccSidebar extends LitElement {
return html`
<div
class="selectOption ${this.selectedItem === item ? 'selected' : console.log('hi')}"
@click=${() => {
@click=${async () => {
const domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.selectItem(item);
this.dashboardRef.domtools.router.pushUrl(`/elements/${elementName}`);
domtools.router.pushUrl(`/elements/${elementName}`);
}}
>
<i class="material-icons">featured_video</i>