mirror of https://github.com/sveltejs/svelte
fix: migrate reactive statements with inner blocks (#13675)
parent
f398929fdd
commit
c9d85c2d52
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: migrate reactive statements with inner blocks
|
@ -0,0 +1,17 @@
|
||||
<script lang="ts">
|
||||
let menuElement: HTMLUListElement | undefined = undefined;
|
||||
let left: number;
|
||||
let top: number;
|
||||
|
||||
$: {
|
||||
if (menuElement) {
|
||||
const rect = menuElement.getBoundingClientRect();
|
||||
const menuHeight = 0;
|
||||
|
||||
left = window.innerWidth - rect.width
|
||||
top = window.innerHeight - menuHeight;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<ul bind:this={menuElement}></ul>
|
@ -0,0 +1,19 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
let menuElement: HTMLUListElement | undefined = $state(undefined);
|
||||
let left: number = $state();
|
||||
let top: number = $state();
|
||||
|
||||
run(() => {
|
||||
if (menuElement) {
|
||||
const rect = menuElement.getBoundingClientRect();
|
||||
const menuHeight = 0;
|
||||
|
||||
left = window.innerWidth - rect.width
|
||||
top = window.innerHeight - menuHeight;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<ul bind:this={menuElement}></ul>
|
Loading…
Reference in new issue