Fix missing button images when image was not set before first update

This commit is contained in:
nathan 2022-07-27 13:03:44 -06:00
parent 93167940f8
commit e9f0a5216b
2 changed files with 7 additions and 2 deletions

View File

@ -11,6 +11,7 @@
import {css} from "@lion/core";
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
import '../Et2Image/Et2Image';
import {SlButton} from "@shoelace-style/shoelace";
import shoelace from "../Styles/shoelace";
@ -70,7 +71,7 @@ export class Et2Button extends Et2InputWidget(SlButton)
width: 16px !important;
}
::slotted(et2-image) {
width: 20px;
max-width: 20px;
display: flex;
}
::slotted([slot="icon"][src='']) {

View File

@ -9,7 +9,7 @@
*/
import {css, html, LitElement, SlotMixin} from "@lion/core";
import {css, html, LitElement, render, SlotMixin} from "@lion/core";
import {Et2Widget} from "../Et2Widget/Et2Widget";
import {et2_IDetachedDOM} from "../et2_core_interfaces";
@ -171,6 +171,10 @@ export class Et2Image extends Et2Widget(SlotMixin(LitElement)) implements et2_ID
{
super.updated(changedProperties);
if(changedProperties.has("src") && !this._img)
{
render(this._imageTemplate(), this);
}
if(changedProperties.has("src") && this._img)
{
this._img.setAttribute("src", this.parse_href(this.src) || this.parse_href(this.defaultSrc));