将 Svelte 与 Stencil 组件一起使用
Use Svelte with Stencil components
我们想用 svelte 构建一个应用程序,但一直坚持使用我们用 stenciljs 构建的组件。
起初它看起来像一个魅力,但由于模板组件使用术语“slot”而 svelte 也这样做,我在 svelte
上使用此组件时遇到错误
Element with a slot='...' attribute must be a child of a component or
a descendant of a custom element
。我理解这个问题,问题是如何忽略它或告诉 svelte 忽略某些元素。有那个功能吗?
我尝试使用的组件如下所示:
<my-ui-image
slot="image"
src="/images/image.png"
shadow-on-image="false"
alt="image alt"
title="Image title"
/>
检查此 post 是否有命名插槽 ->
How to get the slots value in a Svelte component?
我希望它能给你方向..
所以我又试了一次,问题消失了。
我们想用 svelte 构建一个应用程序,但一直坚持使用我们用 stenciljs 构建的组件。 起初它看起来像一个魅力,但由于模板组件使用术语“slot”而 svelte 也这样做,我在 svelte
上使用此组件时遇到错误Element with a slot='...' attribute must be a child of a component or a descendant of a custom element
。我理解这个问题,问题是如何忽略它或告诉 svelte 忽略某些元素。有那个功能吗?
我尝试使用的组件如下所示:
<my-ui-image
slot="image"
src="/images/image.png"
shadow-on-image="false"
alt="image alt"
title="Image title"
/>
检查此 post 是否有命名插槽 -> How to get the slots value in a Svelte component? 我希望它能给你方向..
所以我又试了一次,问题消失了。