【问题标题】:Aurelia: Multiple Slots in Template?Aurelia:模板中有多个插槽?
【发布时间】:2016-09-29 21:13:01
【问题描述】:

自定义组件中是否可以有多个插槽?

<template>
   <slot id="first"></slot> 
   <slot id="second"></slot>
</template>

【问题讨论】:

    标签: html aurelia aurelia-templating


    【解决方案1】:

    是的,但您应该使用name 而不是id

    <template>  
      <div>
        The first slot:
        <div>
          <slot name="slot1"></slot>
        </div>
        The second slot:
        <div>
          <slot name="slot2"></slot>
        </div>
      </div>
    </template>  
    

    现在记录在这里:http://blog.durandal.io/2016/05/23/aurelia-shadow-dom-v1-slots-prerelease/我很快就会将它添加到自定义元素文档的内容投影部分。

    【讨论】:

    • 顺便说一句,所有投影标签(插槽、路由器视图、内容)都允许后备内容吗?
    • 这仅适用于插槽。请注意,内容即将消失
    猜你喜欢
    • 2017-12-31
    • 1970-01-01
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    相关资源
    最近更新 更多