首页 > 技术文章 > 03-插槽的使用(具名插槽、作用域插槽)

pgdrng 2020-11-04 13:03 原文

1.插槽 (组件components)

2.具名插槽:slot 加入name属性,父组件修改根据slot = name


components:{
"cpn : { template : '#cpn'}
}

2.作用域
子组件及父组件作用域;

3.作用域插槽
父组件获取子组件插槽的数据

{{slot.data}}

推荐阅读