Merge pull request #13663 from j3rem1e/fixes-duplicate-preview

Svelte: Fix duplicate story preview
This commit is contained in:
Michael Shilman 2021-01-22 18:23:22 +08:00 committed by GitHub
commit f89c14bb1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,19 +1,7 @@
<script>
import { onMount } from 'svelte';
export let component;
export let props;
let child;
const hash = `svelte mounter ${Math.floor(Math.random() * 100)}`;
onMount(() => {
child = new component({
target: document.getElementById(hash),
props,
});
});
</script>
<svelte:options accessors={true} />
<div id={hash} />
<svelte:component this={component} {...props}/>