Remove styleMap for base-unit (#2428)

This commit is contained in:
Bram Kragten 2019-01-09 23:04:49 +01:00 committed by Paulus Schoutsen
parent 2517e5ba60
commit e9d912cc87

View File

@ -104,10 +104,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
return html`
${this.renderStyle()}
<ha-card
@click="${this._handleClick}"
style="${styleMap({ "--base-unit": this._computeBaseUnit() })}"
>
<ha-card @click="${this._handleClick}">
${
error
? html`
@ -150,6 +147,15 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
return hasConfigOrEntityChanged(this, changedProps);
}
protected firstUpdated(): void {
(this.shadowRoot!.querySelector(
"ha-card"
)! as HTMLElement).style.setProperty(
"--base-unit",
this._computeBaseUnit()
);
}
protected updated(changedProps: PropertyValues): void {
super.updated(changedProps);
if (!this._config || !this.hass) {