内部内容复合组件
Inner content composite component
我有我的复合组件 <my:panel/>
:
<composite:interface>
<composite:attribute name="header" />
<composite:attribute name="content" />
</composite:interface>
<composite:implementation>
<div class="panel panel-default">
<div class="panel-heading">#{cc.attrs.header}</div>
<div class="panel-body">
#{cc.attrs.content}
</div>
</div>
</composite:implementation>
我用过:
<my:panel header="My header" content="My content" />
好吧,现在我想在内容属性中添加 html(例如 html table)代码。
<my:tag/>
我怎么能这样工作?
<my:tag header="My header" >
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
</table>
</my:tag>
尝试<composite:insertChildren/>
?
<composite:interface>
<composite:attribute name="header" />
<composite:attribute name="content" />
</composite:interface>
<composite:implementation>
<div class="panel panel-default">
<div class="panel-heading">#{cc.attrs.header}</div>
<div class="panel-body">
#{cc.attrs.content}
</div>
</div>
<composite:insertChildren/>
</composite:implementation>
我有我的复合组件 <my:panel/>
:
<composite:interface>
<composite:attribute name="header" />
<composite:attribute name="content" />
</composite:interface>
<composite:implementation>
<div class="panel panel-default">
<div class="panel-heading">#{cc.attrs.header}</div>
<div class="panel-body">
#{cc.attrs.content}
</div>
</div>
</composite:implementation>
我用过:
<my:panel header="My header" content="My content" />
好吧,现在我想在内容属性中添加 html(例如 html table)代码。
<my:tag/>
我怎么能这样工作?
<my:tag header="My header" >
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
</table>
</my:tag>
尝试<composite:insertChildren/>
?
<composite:interface>
<composite:attribute name="header" />
<composite:attribute name="content" />
</composite:interface>
<composite:implementation>
<div class="panel panel-default">
<div class="panel-heading">#{cc.attrs.header}</div>
<div class="panel-body">
#{cc.attrs.content}
</div>
</div>
<composite:insertChildren/>
</composite:implementation>