Skip to content

PageHeader 页头

用于显示页面标题和导航信息,常用于页面顶部。

基础用法

页面标题这是一个副标题描述
vue
<template>
  <x-page-header title="页面标题" subtitle="这是一个副标题描述" />
</template>

<script setup>
import { PageHeader } from '@xto/navigation'
</script>

带返回按钮

设置 showBack 显示返回按钮,点击时触发 back 事件。

返回详情页面
vue
<template>
  <x-page-header
    title="详情页面"
    show-back
    @back="handleBack"
  />
</template>

<script setup>
import { PageHeader } from '@xto/navigation'

const handleBack = () => {
  console.log('点击返回')
}
</script>

自定义返回按钮文字

通过 backText 自定义返回按钮文字。

返回列表编辑页面
vue
<template>
  <x-page-header
    title="编辑页面"
    back-text="返回列表"
    show-back
    @back="handleBack"
  />
</template>

操作区域

使用 extra 插槽添加操作按钮。

用户管理管理系统中的所有用户
vue
<template>
  <x-page-header title="用户管理" subtitle="管理系统中的所有用户">
    <template #extra>
      <x-button type="primary" size="small">新增用户</x-button>
      <x-button size="small">导出数据</x-button>
    </template>
  </x-page-header>
</template>

底部内容

使用 footer 插槽添加底部内容,常用于放置标签页或筛选条件。

返回订单详情

自定义标题

使用 title 插槽自定义标题内容。

自定义标题 (已启用)
vue
<template>
  <x-page-header>
    <template #title>
      <span style="color: #409eff;">自定义标题</span>
    </template>
  </x-page-header>
</template>

API

Props

属性说明类型默认值
title标题string''
subtitle副标题string''
backText返回按钮文字string'返回'
showBack是否显示返回按钮booleanfalse

Events

事件名说明回调参数
back点击返回按钮时触发

Slots

插槽名说明
default默认内容
title自定义标题
subtitle自定义副标题
extra操作区域
footer底部内容

基于 MIT 许可发布