Conflicts of custom elements' named slot (defineCustomElement) #6574
-
Link to minimal reproduction edit/vitejs-vite-sxhlbh?file=src/App.vue custom-element below is a web component This snippets working as expected, but eslint complaint about it
<custom-element>
<span slot="icon">hello, world</span>
</custom-element> Below snippets trigger compiler error
<custom-element>
<template #icon>
<span>hello, world</span>
</template>
</custom-element> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The first way (with a https://vuejs.org/guide/extras/web-components.html#slots So a workaround would be to skip this rule in these instances: <custom-element>
<!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
<span slot="icon">hello, world</span>
</custom-element> You can also open an issue in the eslint plugin repo and ask for a fix / feature to skip this rule for custom elements. |
Beta Was this translation helpful? Give feedback.
The first way (with a
slot="icon"
prop) is the correct way, as documented here:https://vuejs.org/guide/extras/web-components.html#slots
So a workaround would be to skip this rule in these instances:
You can also open an issue in the eslint plugin repo and ask for a fix / feature to skip this rule for custom elements.