20260720172840
This commit is contained in:
1 parent
cda7f16d3a
commit
94207c77ff
3117 files changed
+201407
-1236
No files matched your search
@@ -0,0 +1,115 @@
|
||||
# Basic Structure
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
Classic page layouts.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<a-flex gap="middle" wrap>
|
||||
<a-layout class="demo-layout">
|
||||
<a-layout-header class="demo-header">
|
||||
Header
|
||||
</a-layout-header>
|
||||
<a-layout-content class="demo-content">
|
||||
Content
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Footer
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
|
||||
<a-layout class="demo-layout">
|
||||
<a-layout-header class="demo-header">
|
||||
Header
|
||||
</a-layout-header>
|
||||
<a-layout>
|
||||
<a-layout-sider width="25%" class="demo-sider">
|
||||
Sider
|
||||
</a-layout-sider>
|
||||
<a-layout-content class="demo-content">
|
||||
Content
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Footer
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
|
||||
<a-layout class="demo-layout">
|
||||
<a-layout-header class="demo-header">
|
||||
Header
|
||||
</a-layout-header>
|
||||
<a-layout>
|
||||
<a-layout-content class="demo-content">
|
||||
Content
|
||||
</a-layout-content>
|
||||
<a-layout-sider width="25%" class="demo-sider">
|
||||
Sider
|
||||
</a-layout-sider>
|
||||
</a-layout>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Footer
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
|
||||
<a-layout class="demo-layout">
|
||||
<a-layout-sider width="25%" class="demo-sider">
|
||||
Sider
|
||||
</a-layout-sider>
|
||||
<a-layout>
|
||||
<a-layout-header class="demo-header">
|
||||
Header
|
||||
</a-layout-header>
|
||||
<a-layout-content class="demo-content">
|
||||
Content
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Footer
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.demo-layout {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
width: calc(50% - 8px);
|
||||
max-width: calc(50% - 8px);
|
||||
}
|
||||
|
||||
.demo-header {
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
height: 64px;
|
||||
padding-inline: 48px;
|
||||
line-height: 64px;
|
||||
background-color: #4096ff;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
text-align: center;
|
||||
min-height: 120px;
|
||||
line-height: 120px;
|
||||
color: #fff;
|
||||
background-color: #0958d9;
|
||||
}
|
||||
|
||||
.demo-sider {
|
||||
text-align: center;
|
||||
line-height: 120px;
|
||||
color: #fff;
|
||||
background-color: #1677ff;
|
||||
}
|
||||
|
||||
.demo-footer {
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
background-color: #4096ff;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
# Custom trigger
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
If you want to use a customized trigger, you can hide the default one.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { MenuItemType } from 'antdv-next'
|
||||
import {
|
||||
MenuFoldOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
|
||||
const collapsed = ref(false)
|
||||
|
||||
const items: MenuItemType[] = [
|
||||
{ key: '1', icon: UserOutlined, label: 'nav 1' },
|
||||
{ key: '2', icon: VideoCameraOutlined, label: 'nav 2' },
|
||||
{ key: '3', icon: UploadOutlined, label: 'nav 3' },
|
||||
]
|
||||
|
||||
function toggleCollapsed() {
|
||||
collapsed.value = !collapsed.value
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-sider v-model:collapsed="collapsed" collapsible>
|
||||
<div class="demo-logo-vertical" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
:default-selected-keys="['1']"
|
||||
:items="items"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout>
|
||||
<a-layout-header class="custom-header" :style="{ background: token.colorBgContainer }">
|
||||
<a-button type="text" class="trigger-button" @click="toggleCollapsed">
|
||||
<template #icon>
|
||||
<MenuUnfoldOutlined v-if="collapsed" />
|
||||
<MenuFoldOutlined v-else />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-layout-header>
|
||||
<a-layout-content
|
||||
class="custom-content"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
Content
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.custom-header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.custom-content {
|
||||
margin: 24px 16px;
|
||||
padding: 24px;
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
.trigger-button {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.demo-logo-vertical {
|
||||
height: 32px;
|
||||
margin: 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,115 @@
|
||||
# Fixed Sider
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
When dealing with long content, a sticky sider can provide a better user experience.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { MenuItemType } from 'antdv-next'
|
||||
import type { CSSProperties } from 'vue'
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
BarChartOutlined,
|
||||
CloudOutlined,
|
||||
ShopOutlined,
|
||||
TeamOutlined,
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const siderStyle: CSSProperties = {
|
||||
overflow: 'auto',
|
||||
height: '100vh',
|
||||
position: 'sticky',
|
||||
insetInlineStart: 0,
|
||||
top: 0,
|
||||
scrollbarWidth: 'thin',
|
||||
scrollbarGutter: 'stable',
|
||||
}
|
||||
|
||||
const items: MenuItemType[] = [
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
UploadOutlined,
|
||||
BarChartOutlined,
|
||||
CloudOutlined,
|
||||
AppstoreOutlined,
|
||||
TeamOutlined,
|
||||
ShopOutlined,
|
||||
].map((icon, index) => ({
|
||||
key: String(index + 1),
|
||||
icon,
|
||||
label: `nav ${index + 1}`,
|
||||
}))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout :has-sider="true">
|
||||
<a-layout-sider :style="siderStyle">
|
||||
<div class="demo-logo-vertical" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
:default-selected-keys="['4']"
|
||||
:items="items"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout>
|
||||
<a-layout-header class="fixed-header" :style="{ background: token.colorBgContainer }" />
|
||||
<a-layout-content class="fixed-content">
|
||||
<div
|
||||
class="fixed-content-box"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
<p>long content</p>
|
||||
<template v-for="index in 100" :key="index">
|
||||
{{ index % 20 === 0 && index !== 0 ? 'more' : '...' }}
|
||||
<br>
|
||||
</template>
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="fixed-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.fixed-header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.fixed-content {
|
||||
margin: 24px 16px 0;
|
||||
overflow: initial;
|
||||
}
|
||||
|
||||
.fixed-content-box {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fixed-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo-vertical {
|
||||
height: 32px;
|
||||
margin: 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,99 @@
|
||||
# Fixed Header
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
Sticky Header is generally used to fix the top navigation to facilitate page switching.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { BreadcrumbItemType, MenuItemType } from 'antdv-next'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const items: MenuItemType[] = Array.from({ length: 3 }).map((_, index) => ({
|
||||
key: String(index + 1),
|
||||
label: `nav ${index + 1}`,
|
||||
}))
|
||||
|
||||
const breadcrumbItems: BreadcrumbItemType[] = [
|
||||
{ title: 'Home' },
|
||||
{ title: 'List' },
|
||||
{ title: 'App' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-header class="demo-header">
|
||||
<div class="demo-logo" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
:default-selected-keys="['2']"
|
||||
:items="items"
|
||||
class="demo-menu"
|
||||
/>
|
||||
</a-layout-header>
|
||||
<a-layout-content class="demo-content">
|
||||
<a-breadcrumb class="demo-breadcrumb" :items="breadcrumbItems" />
|
||||
<div
|
||||
class="demo-content-box"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.demo-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.demo-menu {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
padding: 0 48px;
|
||||
}
|
||||
|
||||
.demo-breadcrumb {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.demo-content-box {
|
||||
padding: 24px;
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.demo-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo {
|
||||
width: 120px;
|
||||
height: 32px;
|
||||
margin: 16px 24px 16px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,101 @@
|
||||
# Responsive
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
a-layout-sider supports responsive layout.
|
||||
|
||||
> Note: You can get a responsive layout by setting `breakpoint`. The Sider will collapse to the width of `collapsedWidth` when window width is below the `breakpoint`. A special trigger will appear if `collapsedWidth` is set to 0.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { MenuItemType } from 'antdv-next'
|
||||
import { BarsOutlined, UploadOutlined, UserOutlined, VideoCameraOutlined } from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const items: MenuItemType[] = [UserOutlined, VideoCameraOutlined, UploadOutlined, UserOutlined].map(
|
||||
(icon, index) => ({
|
||||
key: String(index + 1),
|
||||
icon,
|
||||
label: `nav ${index + 1}`,
|
||||
}),
|
||||
)
|
||||
|
||||
function handleBreakpoint(broken: boolean) {
|
||||
console.log(broken)
|
||||
}
|
||||
|
||||
function handleCollapse(collapsed: boolean, type: string) {
|
||||
console.log(collapsed, type)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-sider
|
||||
breakpoint="lg"
|
||||
:collapsed-width="0"
|
||||
@breakpoint="handleBreakpoint"
|
||||
@collapse="handleCollapse"
|
||||
>
|
||||
<template #trigger>
|
||||
<BarsOutlined />
|
||||
</template>
|
||||
<div class="demo-logo-vertical" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
:default-selected-keys="['4']"
|
||||
:items="items"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout>
|
||||
<a-layout-header class="responsive-header" :style="{ background: token.colorBgContainer }" />
|
||||
<a-layout-content class="responsive-content">
|
||||
<div
|
||||
class="responsive-content-box"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
content
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="responsive-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.responsive-header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.responsive-content {
|
||||
margin: 24px 16px 0;
|
||||
}
|
||||
|
||||
.responsive-content-box {
|
||||
padding: 24px;
|
||||
min-height: 360px;
|
||||
}
|
||||
|
||||
.responsive-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo-vertical {
|
||||
height: 32px;
|
||||
margin: 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,133 @@
|
||||
# Sider
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
Two-columns layout. The sider menu can be collapsed when horizontal space is limited.
|
||||
|
||||
Generally, the mainnav is placed on the left side of the page, and the secondary menu is placed on the top of the working area. Contents will adapt the layout to the viewing area to improve the horizontal space usage, while the layout of the whole page is not stable.
|
||||
|
||||
The level of the aside navigation is scalable. The first, second, and third level navigations could be present more fluently and relevantly, and aside navigation can be fixed, allowing the user to quickly switch and spot the current position, improving the user experience. However, this navigation occupies some horizontal space of the contents.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { BreadcrumbItemType, MenuItemType } from 'antdv-next'
|
||||
import {
|
||||
DesktopOutlined,
|
||||
FileOutlined,
|
||||
LeftOutlined,
|
||||
PieChartOutlined,
|
||||
RightOutlined,
|
||||
TeamOutlined,
|
||||
UserOutlined,
|
||||
} from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const collapsed = ref(false)
|
||||
|
||||
const items: MenuItemType[] = [
|
||||
{ key: '1', icon: PieChartOutlined, label: 'Option 1' },
|
||||
{ key: '2', icon: DesktopOutlined, label: 'Option 2' },
|
||||
{
|
||||
key: 'sub1',
|
||||
icon: UserOutlined,
|
||||
label: 'User',
|
||||
children: [
|
||||
{ key: '3', label: 'Tom' },
|
||||
{ key: '4', label: 'Bill' },
|
||||
{ key: '5', label: 'Alex' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'sub2',
|
||||
icon: TeamOutlined,
|
||||
label: 'Team',
|
||||
children: [
|
||||
{ key: '6', label: 'Team 1' },
|
||||
{ key: '8', label: 'Team 2' },
|
||||
],
|
||||
},
|
||||
{ key: '9', icon: FileOutlined, label: 'Files' },
|
||||
]
|
||||
|
||||
const breadcrumbItems: BreadcrumbItemType[] = [
|
||||
{ title: 'User' },
|
||||
{ title: 'Bill' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout class="side-layout">
|
||||
<a-layout-sider v-model:collapsed="collapsed" collapsible>
|
||||
<template #trigger>
|
||||
<RightOutlined v-if="collapsed" />
|
||||
<LeftOutlined v-else />
|
||||
</template>
|
||||
<div class="demo-logo-vertical" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
:default-selected-keys="['1']"
|
||||
:items="items"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout>
|
||||
<a-layout-header class="side-header" :style="{ background: token.colorBgContainer }" />
|
||||
<a-layout-content class="side-content">
|
||||
<a-breadcrumb class="side-breadcrumb" :items="breadcrumbItems" />
|
||||
<div
|
||||
class="side-content-box"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
Bill is a cat.
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="side-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.side-layout {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.side-header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.side-content {
|
||||
margin: 0 16px;
|
||||
}
|
||||
|
||||
.side-breadcrumb {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.side-content-box {
|
||||
padding: 24px;
|
||||
min-height: 360px;
|
||||
}
|
||||
|
||||
.side-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo-vertical {
|
||||
height: 32px;
|
||||
margin: 16px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,121 @@
|
||||
# Header Sider 2
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
Both the top navigation and the sidebar, commonly used in application site.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { BreadcrumbItemType, MenuItemType } from 'antdv-next'
|
||||
import { LaptopOutlined, NotificationOutlined, UserOutlined } from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
|
||||
const items1: MenuItemType[] = ['1', '2', '3'].map(key => ({
|
||||
key,
|
||||
label: `nav ${key}`,
|
||||
}))
|
||||
|
||||
const items2: MenuItemType[] = [UserOutlined, LaptopOutlined, NotificationOutlined].map((icon, index) => {
|
||||
const key = String(index + 1)
|
||||
return {
|
||||
key: `sub${key}`,
|
||||
icon,
|
||||
label: `subnav ${key}`,
|
||||
children: Array.from({ length: 4 }).map((_, childIndex) => {
|
||||
const childKey = index * 4 + childIndex + 1
|
||||
return {
|
||||
key: String(childKey),
|
||||
label: `option${childKey}`,
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
const breadcrumbItems: BreadcrumbItemType[] = [
|
||||
{ title: 'Home' },
|
||||
{ title: 'List' },
|
||||
{ title: 'App' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-header class="demo-header">
|
||||
<div class="demo-logo" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
:default-selected-keys="['2']"
|
||||
:items="items1"
|
||||
class="demo-menu"
|
||||
/>
|
||||
</a-layout-header>
|
||||
<a-layout>
|
||||
<a-layout-sider :width="200" :style="{ background: token.colorBgContainer }">
|
||||
<a-menu
|
||||
mode="inline"
|
||||
:default-selected-keys="['1']"
|
||||
:default-open-keys="['sub1']"
|
||||
:items="items2"
|
||||
class="demo-sider-menu"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout class="demo-main">
|
||||
<a-breadcrumb class="demo-breadcrumb" :items="breadcrumbItems" />
|
||||
<a-layout-content
|
||||
class="demo-content"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
Content
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.demo-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.demo-menu {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.demo-sider-menu {
|
||||
height: 100%;
|
||||
border-inline-end: 0;
|
||||
}
|
||||
|
||||
.demo-main {
|
||||
padding: 0 24px 24px;
|
||||
}
|
||||
|
||||
.demo-breadcrumb {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
padding: 24px;
|
||||
margin: 0;
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
.demo-logo {
|
||||
width: 120px;
|
||||
height: 32px;
|
||||
margin: 16px 24px 16px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,131 @@
|
||||
# Header-Sider
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
Both the top navigation and the sidebar, commonly used in documentation site.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { BreadcrumbItemType, MenuItemType } from 'antdv-next'
|
||||
import { LaptopOutlined, NotificationOutlined, UserOutlined } from '@antdv-next/icons'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const items1: MenuItemType[] = ['1', '2', '3'].map(key => ({
|
||||
key,
|
||||
label: `nav ${key}`,
|
||||
}))
|
||||
|
||||
const items2: MenuItemType[] = [UserOutlined, LaptopOutlined, NotificationOutlined].map((icon, index) => {
|
||||
const key = String(index + 1)
|
||||
return {
|
||||
key: `sub${key}`,
|
||||
icon,
|
||||
label: `subnav ${key}`,
|
||||
children: Array.from({ length: 4 }).map((_, childIndex) => {
|
||||
const childKey = index * 4 + childIndex + 1
|
||||
return {
|
||||
key: String(childKey),
|
||||
label: `option${childKey}`,
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
const breadcrumbItems: BreadcrumbItemType[] = [
|
||||
{ title: 'Home' },
|
||||
{ title: 'List' },
|
||||
{ title: 'App' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-header class="demo-header">
|
||||
<div class="demo-logo" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
:default-selected-keys="['2']"
|
||||
:items="items1"
|
||||
class="demo-menu"
|
||||
/>
|
||||
</a-layout-header>
|
||||
<div class="demo-body">
|
||||
<a-breadcrumb class="demo-breadcrumb" :items="breadcrumbItems" />
|
||||
<a-layout
|
||||
class="demo-inner"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
<a-layout-sider :style="{ background: token.colorBgContainer }" :width="200">
|
||||
<a-menu
|
||||
mode="inline"
|
||||
:default-selected-keys="['1']"
|
||||
:default-open-keys="['sub1']"
|
||||
:items="items2"
|
||||
class="demo-sider-menu"
|
||||
/>
|
||||
</a-layout-sider>
|
||||
<a-layout-content class="demo-content">
|
||||
Content
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
</div>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.demo-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.demo-menu {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.demo-body {
|
||||
padding: 0 48px;
|
||||
}
|
||||
|
||||
.demo-breadcrumb {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.demo-inner {
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.demo-sider-menu {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
padding: 0 24px;
|
||||
min-height: 280px;
|
||||
}
|
||||
|
||||
.demo-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo {
|
||||
width: 120px;
|
||||
height: 32px;
|
||||
margin: 16px 24px 16px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,99 @@
|
||||
# Header-Content-Footer
|
||||
|
||||
## Description (en-US)
|
||||
|
||||
The most basic \"header-content-footer\" layout.
|
||||
|
||||
Generally, the mainnav is placed at the top of the page, and includes the logo, the first level navigation, and the secondary menu (users, settings, notifications) from left to right in it. We always put contents in a fixed size navigation (eg: `1200px`), the layout of the whole page is stable, it's not affected by the viewing area.
|
||||
|
||||
Top-bottom structure is conformed with the top-bottom viewing habit, it's a classical navigation pattern of websites. This pattern demonstrates efficiency in the main workarea, while using some vertical space. And because the horizontal space of the navigation is limited, this pattern is not suitable for cases when the first level navigation contains many elements or links.
|
||||
|
||||
## Source
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import type { BreadcrumbItemType, MenuItemType } from 'antdv-next'
|
||||
import { theme } from 'antdv-next'
|
||||
|
||||
const { token } = theme.useToken()
|
||||
const year = new Date().getFullYear()
|
||||
|
||||
const items: MenuItemType[] = Array.from({ length: 15 }).map((_, index) => ({
|
||||
key: String(index + 1),
|
||||
label: `nav ${index + 1}`,
|
||||
}))
|
||||
|
||||
const breadcrumbItems: BreadcrumbItemType[] = [
|
||||
{ title: 'Home' },
|
||||
{ title: 'List' },
|
||||
{ title: 'App' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-layout>
|
||||
<a-layout-header class="demo-header">
|
||||
<div class="demo-logo" />
|
||||
<a-menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
:default-selected-keys="['2']"
|
||||
:items="items"
|
||||
class="demo-menu"
|
||||
/>
|
||||
</a-layout-header>
|
||||
<a-layout-content class="demo-content">
|
||||
<a-breadcrumb class="demo-breadcrumb" :items="breadcrumbItems" />
|
||||
<div
|
||||
class="demo-content-box"
|
||||
:style="{
|
||||
background: token.colorBgContainer,
|
||||
borderRadius: `${token.borderRadiusLG}px`,
|
||||
}"
|
||||
>
|
||||
Content
|
||||
</div>
|
||||
</a-layout-content>
|
||||
<a-layout-footer class="demo-footer">
|
||||
Antdv Next ©{{ year }} Created by Ant UED
|
||||
</a-layout-footer>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.demo-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.demo-menu {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
padding: 0 48px;
|
||||
}
|
||||
|
||||
.demo-breadcrumb {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.demo-content-box {
|
||||
min-height: 280px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.demo-footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.demo-logo {
|
||||
width: 120px;
|
||||
height: 32px;
|
||||
margin: 16px 24px 16px 0;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
```
|
||||
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Layout
|
||||
description: Handling the overall layout of a page.
|
||||
---
|
||||
|
||||
## Specification
|
||||
|
||||
### Size
|
||||
|
||||
The first level navigation is left aligned near a logo, and the secondary menu is right aligned.
|
||||
|
||||
- Top Navigation: the height of the first level navigation is `64px`, and the second level navigation is `48px`.
|
||||
- Top Navigation (for landing pages): the height of the first level navigation is `80px`, and the second level navigation is `56px`.
|
||||
- Calculation formula of a top navigation: `48+8n`.
|
||||
- Calculation formula of an aside navigation: `200+8n`.
|
||||
|
||||
### Interaction rules
|
||||
|
||||
- The first level navigation and the last level navigation should be distinguishable by visualization;
|
||||
- The current item should have the highest priority of visualization;
|
||||
- When the current navigation item is collapsed, the style of the current navigation item is applied to its parent level;
|
||||
- The left side navigation bar has support for both the accordion and expanding styles; you can choose the one that fits your case the best.
|
||||
|
||||
## Visualization rules
|
||||
|
||||
Style of a navigation should conform to its level.
|
||||
|
||||
- **Emphasis by colorblock**
|
||||
|
||||
When the background color is a deep color, you can use this pattern for the parent level navigation item of the current page.
|
||||
|
||||
- **The highlight match stick**
|
||||
|
||||
When the background color is a light color, you can use this pattern for the current page navigation item; we recommend using it for the last item of the navigation path.
|
||||
|
||||
- **Highlighted font**
|
||||
|
||||
From the visualization aspect, a highlighted font is stronger than colorblock; this pattern is often used for the parent level of the current item.
|
||||
|
||||
- **Enlarge the size of the font**
|
||||
|
||||
`12px`, `14px` is a standard font size of navigation's, `14px` is used for the first and the second level of the navigation. You can choose an appropriate font size regarding the level of your navigation.
|
||||
|
||||
## Component Overview
|
||||
|
||||
- `Layout`: The layout wrapper, in which `Header` `Sider` `Content` `Footer` or `Layout` itself can be nested, and can be placed in any parent container.
|
||||
- `Header`: The top layout with the default style, in which any element can be nested, and must be placed in `Layout`.
|
||||
- `Sider`: The sidebar with default style and basic functions, in which any element can be nested, and must be placed in `Layout`.
|
||||
- `Content`: The content layout with the default style, in which any element can be nested, and must be placed in `Layout`.
|
||||
- `Footer`: The bottom layout with the default style, in which any element can be nested, and must be placed in `Layout`.
|
||||
|
||||
> Based on `flex layout`, please pay attention to the [compatibility](http://caniuse.com/#search=flex).
|
||||
|
||||
## Demos
|
||||
|
||||
| Demo | Path |
|
||||
| --- | --- |
|
||||
| Basic Structure | demo/basic.md |
|
||||
| Header-Content-Footer | demo/top.md |
|
||||
| Header-Sider | demo/top-side.md |
|
||||
| Header Sider 2 | demo/top-side-2.md |
|
||||
| Sider | demo/side.md |
|
||||
| Custom trigger | demo/custom-trigger.md |
|
||||
| Responsive | demo/responsive.md |
|
||||
| Fixed Header | demo/fixed.md |
|
||||
| Fixed Sider | demo/fixed-sider.md |
|
||||
|
||||
## API
|
||||
|
||||
```html
|
||||
<a-layout>
|
||||
<a-layout-header>header</a-layout-header>
|
||||
<a-layout>
|
||||
<a-layout-sider>left sidebar</a-layout-sider>
|
||||
<a-layout-content>main content</a-layout-content>
|
||||
<a-layout-sider>right sidebar</a-layout-sider>
|
||||
</a-layout>
|
||||
<a-layout-footer>footer</a-layout-footer>
|
||||
</a-layout>
|
||||
```
|
||||
|
||||
### Layout
|
||||
|
||||
Common props ref:[Common props](../../docs/vue/common-props.md)
|
||||
|
||||
The wrapper.
|
||||
|
||||
#### Props
|
||||
| Property | Description | Type | Default | [Global Config](../config-provider/docs.md#component-config) |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| hasSider | Whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering | boolean | - | × |
|
||||
|
||||
### LayoutSider
|
||||
|
||||
#### Props
|
||||
The sidebar.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| breakpoint | [Breakpoints](../grid/docs.md/#col) of the responsive layout | `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `xxl` \| `xxxl` | - | xxxl: 1.0.3 |
|
||||
| classes | Semantic structure class (`root`, `body`) for the Sider, supports object or function | Record<string, string> \| (info: { props }) => Record<string, string> | - | 1.4.0 |
|
||||
| collapsed | To set the current status | boolean | - | |
|
||||
| collapsedWidth | Width of the collapsed sidebar, by setting to 0 a special trigger will appear | number | 80 | |
|
||||
| collapsible | Whether can be collapsed | boolean | false | |
|
||||
| reverseArrow | Reverse direction of arrow, for a sider that expands from the right | boolean | false | |
|
||||
| styles | Semantic structure inline style (`root`, `body`) for the Sider, supports object or function | Record<string, CSSProperties> \| (info: { props }) => Record<string, CSSProperties> | - | 1.4.0 |
|
||||
| theme | Color theme of the sidebar | `light` \| `dark` | `dark` | |
|
||||
| trigger | Specify the customized trigger, set to null to hide the trigger | ReactNode | - | |
|
||||
| width | Width of the sidebar | number \| string | 200 | |
|
||||
| zeroWidthTriggerStyle | To customize the styles of the special trigger that appears when `collapsedWidth` is 0 | object | - | |
|
||||
|
||||
#### Events
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| breakpoint | The callback function, executed when [breakpoints](../grid/docs.md/#api) changed | (broken: boolean) => void | - |
|
||||
| collapse | The callback function, executed by clicking the trigger or activating the responsive layout | (collapsed: boolean, type: string) => void | - |
|
||||
|
||||
## Types
|
||||
|
||||
### Breakpoint width
|
||||
|
||||
```ts
|
||||
const breakpointWidth = {
|
||||
xs: '480px',
|
||||
sm: '576px',
|
||||
md: '768px',
|
||||
lg: '992px',
|
||||
xl: '1200px',
|
||||
xxl: '1600px',
|
||||
xxxl: '1920px',
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
# layout Token
|
||||
|
||||
Use these variables through `theme.components.Layout`. This document lists definitions only and does not include values.
|
||||
|
||||
```vue
|
||||
<a-config-provider
|
||||
:theme="{
|
||||
token: {
|
||||
// Global token configuration
|
||||
},
|
||||
components: {
|
||||
Layout: {
|
||||
// Token name: value
|
||||
},
|
||||
},
|
||||
}"
|
||||
>
|
||||
...
|
||||
</a-config-provider>
|
||||
```
|
||||
|
||||
## Token List
|
||||
|
||||
| Token | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `bodyBg` | `string` | Background Color of body |
|
||||
| `headerBg` | `string` | Background Color of header |
|
||||
| `headerHeight` | `string \| number` | Height of header |
|
||||
| `headerPadding` | `CSSProperties` | Padding of header |
|
||||
| `headerColor` | `string` | Text color of header |
|
||||
| `footerPadding` | `CSSProperties` | Padding of footer |
|
||||
| `footerBg` | `string` | Background Color of footer |
|
||||
| `siderBg` | `string` | Background Color of sider |
|
||||
| `triggerHeight` | `string \| number` | Height of sider trigger |
|
||||
| `triggerBg` | `string` | Background Color of sider trigger |
|
||||
| `triggerColor` | `string` | Color of sider trigger |
|
||||
| `zeroTriggerWidth` | `number` | Width of sider trigger when collapse is 0 |
|
||||
| `zeroTriggerHeight` | `number` | Height of sider trigger when collapse is 0 |
|
||||
| `lightSiderBg` | `string` | Background Color of light theme sider |
|
||||
| `lightTriggerBg` | `string` | Background Color of light theme sider trigger |
|
||||
| `lightTriggerColor` | `string` | Color of light theme sider trigger |
|
||||
Reference in new issue
Block a user