slot---類似ng里面 transclude (指令)
位置、槽口
作用: 占個(gè)位置妖混,將模板中正常html內(nèi)容放到slot中瘦材,,若無html,會顯示slot的內(nèi)容
用法:
(1)單個(gè)占位
<div id="box">
<aaa>
<ul>
<li>1111</li>
<li>2222</li>
<li>3333</li>
</ul>
</aaa>
<aaa>
</aaa>
</div>
<template id="aaa">
<h1>xxxx</h1>
<slot>這是默認(rèn)的情況</slot>
<p>welcome vue</p>
</template>
(2)多個(gè)占位---需要命名區(qū)分
<div id="box">
<aaa>
<ul slot="ul-slot">
<li>1111</li>
<li>2222</li>
<li>3333</li>
</ul>
<ol slot="ol-slot">
<li>111</li>
<li>222</li>
<li>333</li>
</ol>
</aaa>
<hr>
<aaa>
</aaa>
</div>
<template id="aaa">
<h1>xxxx</h1>
<slot name="ol-slot">這是默認(rèn)的情況</slot>
<p>welcome vue</p>
<slot name="ul-slot">這是默認(rèn)的情況2</slot>
</template>