【发布时间】:2017-12-20 16:04:03
【问题描述】:
我现在正在创建包含 material-components-web, cards specifically 的 Aurelia 组件,我想知道实现多个内容部分(动作等)的正确方法是什么。
插槽似乎是正确的选择,但我不能始终将操作 div 放在模板上,但前提是实际存在任何操作。
简单地说,我需要检查是否在组件模板中定义了一个插槽。
<template>
<div class="card">
<div class="content">
<slot></slot>
</div>
<!-- somehow check here if the slot has been defined -->
<div class="actions">
<slot name="actions"></slot>
</div>
</div>
</template>
【问题讨论】:
标签: javascript aurelia