mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
fix(image-loader): updated src
should update the image
Fixes #1677 The `ImageLoader` image should correctly update if `src` changes.
This commit is contained in:
parent
4e6bfd0612
commit
0f318aac77
1 changed files with 21 additions and 17 deletions
|
@ -80,23 +80,7 @@
|
|||
{#if loading}
|
||||
<slot name="loading" />
|
||||
{/if}
|
||||
{#if loaded}
|
||||
<img
|
||||
style:width="100%"
|
||||
{...$$restProps}
|
||||
src="{src}"
|
||||
alt="{alt}"
|
||||
transition:fade|local="{{ duration: fadeIn ? fast02 : 0 }}"
|
||||
/>
|
||||
{/if}
|
||||
{#if error}
|
||||
<slot name="error" />
|
||||
{/if}
|
||||
{:else}
|
||||
<AspectRatio ratio="{ratio}">
|
||||
{#if loading}
|
||||
<slot name="loading" />
|
||||
{/if}
|
||||
{#key src}
|
||||
{#if loaded}
|
||||
<img
|
||||
style:width="100%"
|
||||
|
@ -106,6 +90,26 @@
|
|||
transition:fade|local="{{ duration: fadeIn ? fast02 : 0 }}"
|
||||
/>
|
||||
{/if}
|
||||
{/key}
|
||||
{#if error}
|
||||
<slot name="error" />
|
||||
{/if}
|
||||
{:else}
|
||||
<AspectRatio ratio="{ratio}">
|
||||
{#if loading}
|
||||
<slot name="loading" />
|
||||
{/if}
|
||||
{#key src}
|
||||
{#if loaded}
|
||||
<img
|
||||
style:width="100%"
|
||||
{...$$restProps}
|
||||
src="{src}"
|
||||
alt="{alt}"
|
||||
transition:fade|local="{{ duration: fadeIn ? fast02 : 0 }}"
|
||||
/>
|
||||
{/if}
|
||||
{/key}
|
||||
{#if error}
|
||||
<slot name="error" />
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue