本篇文章主要介绍了vue Render中slots的使用的实例代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。
本文介绍了vue Render中slots的使用的实例代码,有需要了解vue Render中slots用法的朋友可参考。希望此文章对各位有所帮助。
render 中 slot 的一般默认使用方式如下:
this.$slots.default 对用 template的的使用没有name 。
想使用多个slot 的话。需要对slot命名唯一。使用th来4源gaodaimacom搞#代%码*网is.$slots.name 在render中添加多个slot。
<div class="" id="app"> <div>this is slot</div></div>
多个slot的使用
<div class="" id="app"> <div>this is slot</div><div>The position is slot2 </div></div>
在vue2.1.0新添加了scope(虽然感觉有点怪,但是用习惯了,还蛮好用的)。同样给出一般使用和多个使用示例,
<div class="" id="app"> <div>{{props.text}}</div></div>
多个$scopedSlot的使用
<div class="" id="app"> <div>{{props.text}}</div> <span>{{props.text}}</span></div>
以上就是vue Render中slots的使用的实例代码的详细内容,更多请关注gaodaima搞代码网其它相关文章!