-
2 votesanswersviews
Web组件中的槽选择器限制
slot 很适合制作可重复使用的Web组件,但到目前为止它有一个限制 . 我面临的是风格问题 . 你只需要't define the style inside a component, even you know what the inject content'的结构 . 我在github发表的详细信息here 我编写了一个组件,并尝试从外部通过 slot 注入内容,并尝试将样式添加到组件的阴影根... -
1 votesanswersviews
Web组件和影子根
我使用此代码创建一个Web组件,我使用模板: let tmpl = document.createElement('template'); tmpl.innerHTML =`<style> div { color: green; display: inline; margin: 3px; } p { border: 1px solid black; } <...