<svelte:options>
<svelte:options option={value} />The <svelte:options> 元素提供了一个指定每个组件编译器选项的位置,这些选项在 编译器部分 中有详细说明。可能的选项有:
runes={true}— 强制组件进入 符文模式(见 旧版 API 部分)runes={false}— 强制组件进入 旧模式namespace="..."— 该组件将使用的命名空间,可以是“html”(默认值)、“svg”或“mathml”customElement={...}— 使用此组件作为自定义元素时的 选项。如果传递了一个字符串,则将其用作标签选项。css="注入的"— 组件将内联注入其样式:在服务器端渲染期间,它作为<style>标签注入到head中,在客户端渲染期间,它通过 JavaScript 加载
[!过时] Svelte 4 中的过时选项也包括以下选项。它们在 Svelte 5 中已过时,在 runes 模式下不可用。
不可变={true}— 你从不使用可变数据,因此编译器可以进行简单的引用相等性检查,以确定值是否已更改不可变={false}— 默认值。Svelte 对可变对象是否已更改将更加谨慎accessors={true}— 为组件的 props 添加 getter 和 setter访问器={false}— 默认
<svelte:options customElement="my-custom-element" />Edit this page on GitHub llms.txt
previous next