vue slot插槽

1 vue中可以使用插槽替代具体标签

<slot></slot>

(1) 在原模板中使用slot属性绑定

(2)在<slot></slot>标签中使用name属性绑定具体代替插槽的组件

(3)定义具体组件代替插槽

2 示例

 

 效果展示:

 

 具体请访问vue官方文档:https://cn.vuejs.org/v2/guide/components-slots.html

posted @ 2021-07-25 16:26  夜未央111  阅读(39)  评论(0)    收藏  举报