对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>

原文地址:https://www.cnblogs.com/zhouyideboke/p/8674833.html