Перейти к содержимому

Веб-компоненты

scripts/svelte/example.svelte
<svelte:options customElement={{ tag: "spaceapp-example", shadow: "none" }} />
<script lang="ts">
interface Props {
name?: string;
}
let { name = "никто" }: Props = $props();
</script>
<h2 class="bg-blue-200 text-red-700">Привет, {name}!</h2>
scripts/entity/front-page.ts
import "@svelte/example.svelte";
pages/index.astro
---
import Layout from "@components/Layout.astro";
import YandexMap from "@components/YandexMap.astro";
---
<Layout title="Главная страница" scripts={["front-page"]} ymap>
<spaceapp-example name="Вова"></spaceapp-example>
</Layout>