页面特色

GitHub
一个用于展示应用程序主要特性的组件。

用法

PageFeature 组件由 PageSection 组件使用,用于显示功能

标题

使用 title prop 设置功能的标题。

主题
<template>
  <UPageFeature title="Theme" />
</template>

描述

使用 description prop 设置功能的描述。

主题
使用您自己的颜色、字体等自定义 Nuxt UI。
<template>
  <UPageFeature
    title="Theme"
    description="Customize Nuxt UI with your own colors, fonts, and more."
  />
</template>

Icon

使用 icon prop 设置功能的图标。

主题
使用您自己的颜色、字体等自定义 Nuxt UI。
<template>
  <UPageFeature
    title="Theme"
    description="Customize Nuxt UI with your own colors, fonts, and more."
    icon="i-lucide-swatch-book"
  />
</template>

您可以传递<NuxtLink>组件,例如 totargetrel 等。

主题
使用您自己的颜色、字体等自定义 Nuxt UI。
<template>
  <UPageFeature
    title="Theme"
    description="Customize Nuxt UI with your own colors, fonts, and more."
    icon="i-lucide-swatch-book"
    to="/docs/getting-started/theme/design-system"
    target="_blank"
  />
</template>

Orientation

使用 orientation prop 更改功能的方向。默认为 horizontal

主题
使用您自己的颜色、字体等自定义 Nuxt UI。
<template>
  <UPageFeature
    orientation="vertical"
    title="Theme"
    description="Customize Nuxt UI with your own colors, fonts, and more."
    icon="i-lucide-swatch-book"
  />
</template>

API

属性

属性默认值类型
as'div'any

此组件应渲染为的元素或组件。

图标any

orientationhorizontal 时,图标显示在标题旁边;当 orientationvertical 时,图标显示在标题上方。

titlestring
descriptionstring
orientation'horizontal'"horizontal" | "vertical"

页面功能的排列方向。

过渡到string | kt | Tt
targetnull | "_blank" | "_parent" | "_self" | "_top" | string & {}
ui{ root?: ClassNameValue; wrapper?: ClassNameValue; leading?: ClassNameValue; leadingIcon?: ClassNameValue; title?: ClassNameValue; description?: ClassNameValue; }

插槽

插槽类型
前置{ ui: object; }
title{}
description{}
default{}

主题

app.config.ts
export default defineAppConfig({
  ui: {
    pageFeature: {
      slots: {
        root: 'relative rounded-sm',
        wrapper: '',
        leading: 'inline-flex items-center justify-center',
        leadingIcon: 'size-5 shrink-0 text-primary',
        title: 'text-base text-pretty font-semibold text-highlighted',
        description: 'text-[15px] text-pretty text-muted'
      },
      variants: {
        orientation: {
          horizontal: {
            root: 'flex items-start gap-2.5',
            leading: 'p-0.5'
          },
          vertical: {
            leading: 'mb-2.5'
          }
        },
        to: {
          true: {
            root: [
              'has-focus-visible:ring-2 has-focus-visible:ring-primary',
              'transition'
            ]
          }
        },
        title: {
          true: {
            description: 'mt-1'
          }
        }
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        pageFeature: {
          slots: {
            root: 'relative rounded-sm',
            wrapper: '',
            leading: 'inline-flex items-center justify-center',
            leadingIcon: 'size-5 shrink-0 text-primary',
            title: 'text-base text-pretty font-semibold text-highlighted',
            description: 'text-[15px] text-pretty text-muted'
          },
          variants: {
            orientation: {
              horizontal: {
                root: 'flex items-start gap-2.5',
                leading: 'p-0.5'
              },
              vertical: {
                leading: 'mb-2.5'
              }
            },
            to: {
              true: {
                root: [
                  'has-focus-visible:ring-2 has-focus-visible:ring-primary',
                  'transition'
                ]
              }
            },
            title: {
              true: {
                description: 'mt-1'
              }
            }
          }
        }
      }
    })
  ]
})

更新日志

v4.5.0
  • c9704— feat(Theme): 新组件 (#4387)
  • 6dd73— chore(deps): 更新 nuxt framework 至 ^4.3.0 (v4) (#5923)
v4.3.0
  • 47d93— fix(BlogPost/ChangelogVersion/PageFeature/User): 允许 tab 键聚焦
v4.2.0
  • dd81d— feat(components): 添加 data-slot 属性 (#5447)
v4.1.0
  • 63c0a— feat(components): 在使用的插槽属性中暴露 ui (#5207)
v3.3.3
  • 61b60— feat(Icon): 允许传递组件而非名称 (#4766)
v3.3.1