Nuxt UI v3-alpha 已发布!

试用一下

登录页面部分

一个可定制的登录页面部分。

用法

LandingSection 组件将把您的内容包装在一个 Container 中,但包装器占据屏幕的全部宽度,因此您可以轻松更改背景。

使用 headlinetitledescription 道具来定制部分的内容。

专业版

构建任何事物的自由

Nuxt UI Pro 附带一套广泛的高级组件,涵盖各种用例。
<template>
  <ULandingSection
    headline="Pro"
    title="The freedom to build anything"
    description="Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases."
  />
</template>

使用 icon 道具在标题上方添加图标。

构建任何事物的自由

Nuxt UI Pro 附带一套广泛的高级组件,涵盖各种用例。
<template>
  <ULandingSection
    icon="i-heroicons-rocket-launch"
    title="The freedom to build anything"
    description="Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases."
  />
</template>

您可以在默认插槽中添加任何您想要的内容,例如图像、使用 MDC 组件(当使用 @nuxt/content 时)的代码块、LandingGridPageGridPricingGridLandingFAQLandingCTA 等。

您可以将 align 道具从 center 更改为 leftright 以水平定位插槽。

专业版

构建任何事物的自由

Nuxt UI Pro 附带一套广泛的高级组件,涵盖各种用例。
<template>
  <ULandingSection
    headline="Pro"
    title="The freedom to build anything"
    description="Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases."
    align="center"
  >
    <img
      src="https://picsum.photos/640/360"
      class="w-full rounded-md shadow-xl ring-1 ring-gray-300 dark:ring-gray-700"
    />
  </ULandingSection>
</template>

使用 links 道具在描述下方添加一些 按钮。当 align 道具设置为 center 时,这些按钮将渲染在默认插槽下方。

构建任何事物的自由

Nuxt UI Pro 附带一套广泛的高级组件,涵盖各种用例。
<template>
  <ULandingSection
    title="The freedom to build anything"
    description="Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases."
    :links="[{ label: 'Explore components', color: 'gray', trailingIcon: 'i-heroicons-arrow-right', size: 'lg' }]"
    align="left"
  >
    <img
      src="https://picsum.photos/360/640"
      class="w-full rounded-md shadow-xl ring-1 ring-gray-300 dark:ring-gray-700"
    />
  </ULandingSection>
</template>

使用 features 道具在描述下方添加一个功能列表。当 align 道具设置为 center 时,这些功能将以网格形式呈现。

构建任何事物的自由

Nuxt UI Pro 附带一套广泛的高级组件,涵盖各种用例。
完全可定制
与 Nuxt UI 一样,您可以从您的应用配置中更改任何组件的样式,或者通过 ui 道具专门定制它们。
用于所有内容的插槽
每个组件都利用了 Vue 插槽的功能,让您能够灵活地构建任何内容。
<template>
  <ULandingSection
    title="The freedom to build anything"
    description="Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases."
    :features="[{ name: 'Fully customizable', description: 'Like Nuxt UI, change the style of any component from your App Config or customize them specifically through the ui prop.', icon: 'i-heroicons-wrench-screwdriver' }, { name: 'Slots for everything', description: 'Each component leverages the power of Vue's slots to give you the flexibility to build anything.', icon: 'i-heroicons-square-3-stack-3d' }]"
    align="right"
  >
    <img
      src="https://picsum.photos/360/640"
      class="w-full rounded-md shadow-xl ring-1 ring-gray-300 dark:ring-gray-700"
    />
  </ULandingSection>
</template>

您还可以使用 #headline#title#description#links 插槽来定制部分的内容。当使用 @nuxt/content 时,如果您的内容包含 HTML,这将非常有用。

content/index.yml
feature:
  title: The freedom to build anything
  description: Nuxt UI Pro ships with an extensive set of advanced components that cover a wide range of use-cases.
  code: |
    ```vue [app.vue]
    <template>
      <UHeader :links="links" />

      <UMain>
        <ULandingHero title="Hello World" />

        <ULandingSection title="Features">
          <UPageGrid>
            <ULandingCard title="First Card" />
            <ULandingCard title="Second Card" />
            <ULandingCard title="Third Card" />
          </UPageGrid>
        </ULandingSection>
      </UMain>

      <UFooter />
    </template>
    ```
我们在这里使用 .yml 文件作为示例,但您可以使用 @nuxt/content 支持的任何格式,例如 .md.json
pages/index.vue
<script setup lang="ts">
const { data: page } = await useAsyncData('index', () => queryContent('/').findOne())
</script>

<template>
  <ULandingSection>
     <template #title>
      <span v-html="page.feature.title" />
    </template>

    <template #description>
      <span v-html="page.feature.description" />
    </template>

    <MDC
      v-if="page.feature.code"
      :value="page.feature.code"
      tag="pre"
      class="prose prose-primary dark:prose-invert max-w-none"
    />
  </ULandingSection>
</template>

您可以使用 slot 道具更改默认插槽名称,当使用 @nuxt/content 并迭代部分列表时,这将非常有用。

content/index.yml
sections:
  - title: 'The power of<br><span class="text-primary">Vue Components</span>'
    description: 'We love Vue Single-File Components as much as you do.'
    class: 'dark bg-gray-900'
    align: left
    slot: code
    code: |
      ```vue [app.vue]
      <template>
        <NuxtPage />
      </template>
      ```
  - title: 'Compose with<br><span class="text-primary">everything you need.</span>'
    slot: features
    features:
      - title: 'Routing & Layouts'
        description: 'File based routing system to build complex views and interfaces with a powerful and conventional approach.'
        icon: 'i-ph-signpost-duotone'
      - title: 'Data Fetching'
        description: 'Composables that run on the server to fetch data for your components and enable you to render content in different ways.'
        icon: 'i-ph-plugs-connected-duotone'
      - title: 'Assets & Style'
        description: 'Image, Font and Script optizations with a built-in support for CSS Modules, Sass, PostCSS, CSS-in-JS and more.'
        icon: 'i-ph-image-duotone'
pages/index.vue
<script setup lang="ts">
const { data: page } = await useAsyncData('index', () => queryContent('/').findOne())
</script>

<template>
  <ULandingSection v-for="(section, index) of page.sections" :key="index" :slot="section.slot" :class="section.class" :align="section.align" :links="section.links">
    <template #title>
      <span v-html="section.title" />
    </template>

    <template #description>
      <span v-if="section.description" v-html="section.description" />
    </template>

    <template #code>
      <MDC :value="section.code" tag="pre" class="prose prose-primary dark:prose-invert max-w-none" />
    </template>

    <template #features>
      <UPageGrid>
        <UPageCard v-for="(feature, index) in features" :key="index" v-bind="feature" />
      </UPageGrid>
    </template>
  </ULandingSection>
</template>

您可以使用 #top#bottom 插槽在容器上方和下方添加内容,当添加一些绝对定位的 SVG 时,这将非常有用。

插槽

top
{}
icon
{}
headline
{}
title
{}
description
{}
links
{}
bottom
{}

道具

title
字符串
未定义
description
字符串
未定义
icon
字符串
未定义
ui
任何
{}
links
(Button & { click?: (...args: any[]) => void; })[]
[]
align
"left" | "center" | "right"
"center"
headline
字符串
未定义
features
{ icon?: string; name: string; description?: string; }[]
[]
slot
字符串
未定义

配置

{
  wrapper: 'py-24 sm:py-32',
  container: 'gap-16 sm:gap-y-24 flex flex-col',
  base: 'text-center flex flex-col items-center',
  icon: {
    wrapper: 'flex mb-6',
    base: 'w-10 h-10 flex-shrink-0 text-primary'
  },
  headline: 'mb-2 text-base/7 font-semibold text-primary',
  title: 'text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl lg:text-5xl',
  description: 'mt-6 text-lg/8 text-gray-600 dark:text-gray-300',
  links: 'mt-8 flex flex-wrap gap-x-3 gap-y-1.5',
  features: {
    wrapper: {
      base: 'mt-6 leading-7',
      list: 'space-y-4',
      grid: 'grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 lg:gap-x-8 lg:gap-y-16'
    },
    base: 'relative pl-8',
    name: 'font-semibold text-gray-900 dark:text-white',
    description: 'text-gray-500 dark:text-gray-400 leading-6',
    icon: {
      base: 'absolute left-0 top-1 h-5 w-5 text-primary',
      name: 'i-heroicons-check-circle-20-solid'
    }
  }
}