Использование
Пропс navigation принимает navigation — то, что возвращает запрос навигации приложения.
Тип
Пропс type со значением single оставляет открытым только один раздел. По умолчанию — multiple.
<script setup lang="ts">
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation type="single" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation type="single" />
</template>
Цвет
Пропс color задаёт цвет активной ссылки.
<script setup lang="ts">
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation color="air-primary-success" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation color="air-primary-success" />
</template>
Вариант
Пропс variant меняет вид ссылок: pill — активная ссылка на подложке, link — без подложки.
<script setup lang="ts">
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation variant="link" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation variant="link" />
</template>
Подсветка
Пропс highlight рисует линию рядом с активной ссылкой.
Пропс highlight-color задаёт цвет линии. По умолчанию он равен color.
<script setup lang="ts">
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation
highlight
highlight-color="air-primary"
color="air-primary"
variant="pill"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation
highlight
highlight-color="air-primary"
color="air-primary"
variant="pill"
/>
</template>
Значок раскрытия
Пропс trailing-icon задаёт иконку у разделов с вложенными ссылками. По умолчанию — i-bx24-outline-chevron-down-l.
<script setup lang="ts">
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation trailing-icon="i-bx24-actions-arrow-to-the-top" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { ContentNavigationLink } from '@bxshefby/b24ui-nuxt'
const navigation = ref<ContentNavigationLink[]>([
{
title: 'Руководство',
icon: 'i-bx24-crm-book-open',
path: '#getting-started',
children: [
{
title: 'Введение',
path: '#introduction',
active: true
},
{
title: 'Установка',
path: '#installation'
}
]
},
{
title: 'Композаблы',
icon: 'i-bx24-outline-database',
path: '#composables',
children: [
{
title: 'defineShortcuts',
path: '#defineshortcuts'
},
{
title: 'useOverlay',
path: '#useoverlay'
}
]
}
])
</script>
<template>
<B24ContentNavigation trailing-icon="i-bx24-actions-arrow-to-the-top" />
</template>
Примеры
В макете
Компонент ставится в PageAside макета и показывает навигацию по страницам:
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
</script>
<template>
<B24Page>
<template #left>
<B24PageAside>
<B24ContentNavigation :navigation="navigation" highlight />
</B24PageAside>
</template>
<slot />
</B24Page>
</template>
В шапке
В слоте body компонента Header навигация видна на телефоне:
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
</script>
<template>
<B24Header>
<template #body>
<B24ContentNavigation :navigation="navigation" highlight />
</template>
</B24Header>
</template>
API
Пропсы
Слоты
События
Тема
EditorToolbar
Настраиваемая панель инструментов редактора с несколькими режимами показа: фиксированная, всплывающая над выделением или плавающая.
ContentSearch
Готовая командная палитра для вашей документации.
Была ли страница полезна?