谷若汐2018-10-24
有没有办法在Vue组件中设置slot的样式?
<slot style="position: absolute"></slot>
和
<slot class="slot"></slot>
都无效.
Wrap the slot in a <div> and style the <div> instead:
<div>
<div style="..."> <slot></slot> </div>
If you really need to style the slot element, you can use CSS selectors like this:
<div class="wrapper"> <slot></slot> </div>
.wrapper > * { color: red; }
Newest Answer
Wrap the slot in a
<div>
and style the<div>
instead:If you really need to style the slot element, you can use CSS selectors like this: