Panel 卡片

February 27, 2026 · View on GitHub

卡片容器组件,支持标题、全屏等功能。

引入

import { APanel } from '@airpower/web'

Props

参数说明类型默认值必填
title卡片标题string''
description描述string''
showTitle是否显示标题booleantrue
hideIcon是否显示图标booleanfalse
allowFullscreen是否允许全屏booleanfalse

Emits

Slots

插槽名说明作用域参数
default卡片内容-
icon标题图标-
headerRight标题右侧区域-

示例

<template>
  <!-- 基础用法 -->
  <APanel title="标题">
    <div>内容</div>
  </APanel>

  <!-- 带图标 -->
  <APanel title="标题">
    <template #icon>
      <ElIcon><User /></ElIcon>
    </template>
    <div>内容</div>
  </APanel>

  <!-- 允许全屏 -->
  <APanel 
    title="标题"
    allow-fullscreen
  >
    <div>内容</div>
  </APanel>

  <!-- 自定义标题右侧 -->
  <APanel title="标题">
    <template #headerRight>
      <AButton size="small">操作</AButton>
    </template>
    <div>内容</div>
  </APanel>

  <!-- 隐藏标题 -->
  <APanel :show-title="false">
    <div>内容</div>
  </APanel>
</template>

注意事项

  • 如未传入 title,会尝试从路由 meta 中读取
  • 全屏模式下卡片会固定定位覆盖整个页面
  • 支持所有 Element Plus 原生属性和事件(通过 $attrs 透传)