Skip to content

<EventsWidget>

INFO

<EventsWidget> 组件必须在 <DesignerRoot> 组件内使用。

<EventsWidget> 显示当前选中场景或模块的事件列表。它根据 type prop 从 state.currentScenestate.currentModule 中读取事件 ID。

Props

Prop类型默认值说明
type"scene" | "module""scene"显示当前场景还是当前模块的事件

插槽

插槽作用域说明
#contentevent(Event 对象)渲染每个事件项。必须提供 — 不提供时则显示 empty 插槽。
#empty未提供 #content 时显示。未设置则使用默认提示信息。

使用示例

基础版本

vue
<template>
    <EventsWidget type="module">
        <template #content="event">
            <span>{{ event.type }}</span>
        </template>
    </EventsWidget>
</template>

自定义空状态

vue
<template>
    <EventsWidget type="module">
        <template #content="event">
            <div class="event-item">
                <span>{{ event.title }}</span>
                <button>配置</button>
            </div>
        </template>
        <template #empty>
            <p>该模块尚未定义事件。</p>
        </template>
    </EventsWidget>
</template>

说明

  • 若未提供 #content 插槽,组件将显示 #empty 插槽(或默认的回退提示信息)。
  • 已删除的事件会被过滤掉,防止插槽渲染异常。