Перейти к содержанию

PageAnchors

Список якорных ссылок на странице: иконка в рамке и подпись.

Использование

Компонент PageAnchors выводит список ссылок: на разделы документации, внешние ресурсы, релизы. Текущая ссылка выделена, у ссылки в новой вкладке — значок.

<script setup lang="ts">
import type { PageAnchor } from '@bxshefby/b24ui-nuxt'

const links = ref<PageAnchor[]>([
  {
    label: 'Документация',
    icon: 'i-bx24-outline-file',
    to: '/docs/getting-started/'
  },
  {
    label: 'Компоненты',
    icon: 'i-bx24-outline-folder',
    to: '/docs/components/'
  },
  {
    label: 'Шаблоны',
    icon: 'i-bx24-outline-screen',
    to: 'https://github.com/bx-shef/b24-ui/tree/main/playgrounds',
    target: '_blank'
  },
  {
    label: 'Релизы',
    icon: 'i-bx24-outline-tag',
    to: 'https://github.com/bx-shef/b24-ui/releases',
    target: '_blank'
  }
])
</script>

<template>
  <B24PageAnchors :links="links" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { PageAnchor } from '@bxshefby/b24ui-nuxt'

const links = ref<PageAnchor[]>([
  {
    label: 'Документация',
    icon: 'i-bx24-outline-file',
    to: '/docs/getting-started/'
  },
  {
    label: 'Компоненты',
    icon: 'i-bx24-outline-folder',
    to: '/docs/components/'
  },
  {
    label: 'Шаблоны',
    icon: 'i-bx24-outline-screen',
    to: 'https://github.com/bx-shef/b24-ui/tree/main/playgrounds',
    target: '_blank'
  },
  {
    label: 'Релизы',
    icon: 'i-bx24-outline-tag',
    to: 'https://github.com/bx-shef/b24-ui/releases',
    target: '_blank'
  }
])
</script>

<template>
  <B24PageAnchors :links="links" />
</template>

Пропс links — массив объектов со свойствами:

  • label: string
  • icon?: IconProp
  • class?: any
  • b24ui?: { item?: ClassNameValue, link?: ClassNameValue, linkLabel?: ClassNameValue, linkLabelExternalIcon?: ClassNameValue, linkLeading?: ClassNameValue, linkLeadingIcon?: ClassNameValue }

Можно передать любое свойство компонента Link, например to, target и другие.

<script setup lang="ts">
import type { PageAnchor } from '@bxshefby/b24ui-nuxt'

const links = ref<PageAnchor[]>([
  {
    label: 'Документация',
    icon: 'i-bx24-outline-file',
    to: '/docs/getting-started/'
  },
  {
    label: 'Компоненты',
    icon: 'i-bx24-outline-folder',
    to: '/docs/components/'
  },
  {
    label: 'Шаблоны',
    icon: 'i-bx24-outline-screen',
    to: 'https://github.com/bx-shef/b24-ui/tree/main/playgrounds',
    target: '_blank'
  },
  {
    label: 'Релизы',
    icon: 'i-bx24-outline-tag',
    to: 'https://github.com/bx-shef/b24-ui/releases',
    target: '_blank'
  }
])
</script>

<template>
  <B24PageAnchors :links="links" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { PageAnchor } from '@bxshefby/b24ui-nuxt'

const links = ref<PageAnchor[]>([
  {
    label: 'Документация',
    icon: 'i-bx24-outline-file',
    to: '/docs/getting-started/'
  },
  {
    label: 'Компоненты',
    icon: 'i-bx24-outline-folder',
    to: '/docs/components/'
  },
  {
    label: 'Шаблоны',
    icon: 'i-bx24-outline-screen',
    to: 'https://github.com/bx-shef/b24-ui/tree/main/playgrounds',
    target: '_blank'
  },
  {
    label: 'Релизы',
    icon: 'i-bx24-outline-tag',
    to: 'https://github.com/bx-shef/b24-ui/releases',
    target: '_blank'
  }
])
</script>

<template>
  <B24PageAnchors :links="links" />
</template>
icon — компонент иконки или имя Iconify из набора bx24, например 'i-bx24-outline-file'.

Примеры

В раскладке

PageAnchors внутри PageAside выводит ссылки над навигацией по разделам (NavigationMenu).

layouts/docs.vue
<script setup lang="ts">
import type { NavigationMenuItem, PageAnchor } from '@bxshefby/b24ui-nuxt'

const navigation: NavigationMenuItem[] = [{
  label: 'Начало работы',
  to: '/docs/getting-started'
}, {
  label: 'Компоненты',
  to: '/docs/components'
}]

const links: PageAnchor[] = [{
  label: 'Документация',
  icon: 'i-bx24-outline-file',
  to: '/docs/getting-started'
}, {
  label: 'Компоненты',
  icon: 'i-bx24-outline-folder',
  to: '/docs/components'
}, {
  label: 'Шаблоны',
  icon: 'i-bx24-outline-screen',
  to: 'https://github.com/bx-shef/b24-ui/tree/main/playgrounds',
  target: '_blank'
}, {
  label: 'Релизы',
  icon: 'i-bx24-outline-tag',
  to: 'https://github.com/bx-shef/b24-ui/releases',
  target: '_blank'
}]
</script>

<template>
  <B24Page>
    <template #left>
      <B24PageAside>
        <B24PageAnchors :links="links" />

        <B24Separator type="dashed" />

        <B24NavigationMenu :items="navigation" orientation="vertical" />
      </B24PageAside>
    </template>

    <slot />
  </B24Page>
</template>

API

Пропсы

Пропс По умолчанию Тип
as'nav'any

The element or component this component should render as.

links T[]
b24ui { root?: SlotClass; list?: SlotClass; item?: SlotClass; link?: SlotClass; linkLeading?: SlotClass; linkLeadingIcon?: SlotClass; linkLabel?: SlotClass; linkLabelExternalIcon?: SlotClass; }

Слоты

Слот Тип
link{ link: T; active: boolean; b24ui: object; }
link-leading{ link: T; active: boolean; b24ui: object; }
link-label{ link: T; active: boolean; }
link-trailing{ link: T; active: boolean; }

Тема

Была ли страница полезна?