Aurelia:模板中的多个插槽?

Mei*_*hes 1 html aurelia aurelia-templating

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

<template>
   <slot id="first"></slot> 
   <slot id="second"></slot>
</template>
Run Code Online (Sandbox Code Playgroud)

Ash*_*ant 6

是的,但你应该用name而不是id.

<template>  
  <div>
    The first slot:
    <div>
      <slot name="slot1"></slot>
    </div>
    The second slot:
    <div>
      <slot name="slot2"></slot>
    </div>
  </div>
</template>  
Run Code Online (Sandbox Code Playgroud)

它现在已在此处记录:http://blog.durandal.io/2016/05/23/aurelia-shadow-dom-v1-slots-prerelease/我将把它添加到Custom Elements文档的内容投影部分不久.