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