对vue的solt的理解

//父 <children> <span>12345</span>//这边不会显示 </children>

//子 components: { children: { template: "<button>为了明确作用范围,所以使用button标签</button>" } }

solt 顾名思义就是把元素插进去 很形象

单个solt的话直接放进去都可以了

即:

//父 <children> <span>12345</span>//这边不会显示 </children>

//子 <slot></slot>

多个slot的时候 用name进行指定

//父 <children> <span slot="name1">12345</span> </children>

//子<slot name="name1"></slot>

 

posted @ 2018-03-30 10:32  又回到了起点  阅读(896)  评论(0编辑  收藏  举报