PageHeader页头·续1
<template> <div class="components-page-header-demo-responsive"> <a-page-header style="border: 1px solid rgb(235, 237, 240)" title="Title" sub-title="This is a subtitle" @back="() => $router.go(-1)" > <template #extra> <a-button key="3">Operation</a-button> <a-button key="2">Operation</a-button> <a-button key="1" type="primary">Primary</a-button> </template> <template #footer> <a-tabs default-active-key="1"> <a-tab-pane key="1" tab="Details" /> <a-tab-pane key="2" tab="Rule" /> </a-tabs> </template> <div class="content"> <div class="main"> <a-descriptions size="small" :column="2"> <a-descriptions-item label="Created">Lili Qu</a-descriptions-item> <a-descriptions-item label="Association"> <a>421421</a> </a-descriptions-item> <a-descriptions-item label="Creation Time">2017-01-10</a-descriptions-item> <a-descriptions-item label="Effective Time">2017-10-10</a-descriptions-item> <a-descriptions-item label="Remarks"> Gonghu Road, Xihu District, Hangzhou, Zhejiang, China </a-descriptions-item> </a-descriptions> </div> <div class="extra"> <div :style="{ display: 'flex', width: 'max-content', justifyContent: 'flex-end', }" > <a-statistic title="Status" value="Pending" :style="{ marginRight: '32px', }" /> <a-statistic title="Price" prefix="$" :value="568.08" /> </div> </div> </div> </a-page-header> </div></template><style>.components-page-header-demo-responsive tr:last-child td { padding-bottom: 0;}#components-page-header-demo-responsive .content { display: flex;}#components-page-header-demo-responsive .ant-statistic-content { font-size: 20px; line-height: 28px;}@media (max-width: 576px) { #components-page-header-demo-responsive .content { display: block; } #components-page-header-demo-responsive .main { width: 100%; margin-bottom: 12px; } #components-page-header-demo-responsive .extra { width: 100%; margin-left: 0; text-align: left; }}</style>
白底模式
默认 PageHeader 是透明底色的。在某些情况下,PageHeader 需要自己的背景颜色。
<template> <div class="demo-page-header" style="background-color: #f5f5f5; padding: 24px"> <a-page-header :ghost="false" title="Title" sub-title="This is a subtitle" @back="() => $router.go(-1)" > <template #extra> <a-button key="3">Operation</a-button> <a-button key="2">Operation</a-button> <a-button key="1" type="primary">Primary</a-button> </template> <a-descriptions size="small" :column="3"> <a-descriptions-item label="Created">Lili Qu</a-descriptions-item> <a-descriptions-item label="Association"> <a>421421</a> </a-descriptions-item> <a-descriptions-item label="Creation Time">2017-01-10</a-descriptions-item> <a-descriptions-item label="Effective Time">2017-10-10</a-descriptions-item> <a-descriptions-item label="Remarks"> Gonghu Road, Xihu District, Hangzhou, Zhejiang, China </a-descriptions-item> </a-descriptions> </a-page-header> </div></template><style scoped>.demo-page-header :deep(tr:last-child td) { padding-bottom: 0;}</style>
API
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 自定义标题文字 | string|slot | - | |---|---|---|---|
| subTitle | 自定义的二级标题文字 | string|slot | - | |---|---|---|---|
| ghost | pageHeader 的类型,将会改变背景颜色 | boolean | true |
|---|---|---|---|
| avatar | 标题栏旁的头像 | avatar props | - |
|---|---|---|---|
| backIcon | 自定义 back icon ,如果为 false 不渲染 back icon | string|slot | <ArrowLeft /> | |---|---|---|---|
| tags | title 旁的 tag 列表 | Tag[] | Tag | - | |---|---|---|---|
| extra | 操作区,位于 title 行的行尾 | string|slot | - | |---|---|---|---|
| breadcrumb | 面包屑的配置 | breadcrumb | - |
|---|---|---|---|
| footer | PageHeader 的页脚,一般用于渲染 TabBar | string|slot | - | |---|---|---|---|
事件
| 事件名称 | 说明 | 回调参数 |
|---|---|---|
| back | 返回按钮的点击事件 | function(e) |
|---|---|---|
