en Kooboo Logo 说明文档

Slot

 

事先定义好的位置信息,在运行时可以动态往定义好的Slot中加入外部结果
 
使用的属性定义: 
 
k-slot-define
k-slot-insert
v-slot-define
v-slot-insert
 
示例
 
viewone 预留位置 posone. 
 
<div id=slotview>
    <h2>This view contains slot named: posone</h2> 
    <div k-slot-define="posone">slot content</div> 
</div>
 
parent view, 引用viewone并插入结果 
 
<script env="server">
	var text = "Hello World"    
</script>
<div id=viewinsert>
	<h2>This view Insert Slot</h2>
	<view id="viewone">
		<div id=frominsert k-slot-insert="posone">
			<p k-content="text"></p>
		</div>
	</view>
</div>
 
运行parent view, 如果如下:
 
<div id=viewinsert>
	<h2>This view Insert Slot</h2>
	<div id=slotview>
    <h2>This view contains slot named: posone</h2> 
    <div id="frominsert">
			<p>Hello World</p>
		</div> 
</div>
</div>