FooterColumnsPRO
一个以列形式在页脚中显示的链接列表。
用法
FooterColumns 组件渲染一个列列表,用于显示在您的页脚中。
在 Footer 组件的 top
插槽中使用它
<template>
<UFooter>
<template #top>
<UContainer>
<UFooterColumns />
</UContainer>
</template>
</UFooter>
</template>
列
使用 columns
属性作为一个对象数组,包含以下属性:
label: string
children?: FooterColumnLink[]
每列都包含一个定义链接的对象 children
数组。每个链接可以具有以下属性:
label?: string
icon?: string
class?: any
ui?: { item?: ClassNameValue, link?: ClassNameValue, linkLabel?: ClassNameValue, linkLabelExternalIcon?: ClassNameValue, linkLeadingIcon?: ClassNameValue }
您可以传递 Link 组件的任何属性,例如 to
、target
等。
<script setup lang="ts">
import type { FooterColumn } from '@nuxt/ui-pro'
const columns: FooterColumn[] = [
{
label: 'Community',
children: [
{
label: 'Nuxters',
to: 'https://nuxters.nuxt.com',
target: '_blank'
},
{
label: 'Video Courses',
to: 'https://masteringnuxt.com/nuxt3?ref=nuxt',
target: '_blank'
},
{
label: 'Nuxt on GitHub',
to: 'https://github.com/nuxt',
target: '_blank'
}
]
},
{
label: 'Solutions',
children: [
{
label: 'Nuxt Content',
to: 'https://content.nuxtjs.org.cn/',
target: '_blank'
},
{
label: 'Nuxt DevTools',
to: 'https://devtools.nuxtjs.org.cn/',
target: '_blank'
},
{
label: 'Nuxt Image',
to: 'https://image.nuxtjs.org.cn/',
target: '_blank'
},
{
label: 'Nuxt UI',
to: 'https://ui.nuxtjs.org.cn/',
target: '_blank'
}
]
}
]
</script>
<template>
<UFooterColumns :columns="columns">
<template #right>
<UFormField name="email" label="Subscribe to our newsletter" size="lg">
<UInput type="email" class="w-full">
<template #trailing>
<UButton type="submit" size="xs" color="neutral" label="Subscribe" />
</template>
</UInput>
</UFormField>
</template>
</UFooterColumns>
</template>
API
属性
属性 | 默认值 | 类型 |
---|---|---|
as |
|
此组件应渲染为的元素或组件。 |
columns |
| |
ui |
|
插槽
插槽 | 类型 |
---|---|
left |
|
default |
|
right |
|
column-label |
|
link |
|
link-leading |
|
link-label |
|
link-trailing |
|
主题
app.config.ts
export default defineAppConfig({
uiPro: {
footerColumns: {
slots: {
root: 'xl:grid xl:grid-cols-3 xl:gap-8',
left: 'mb-10 xl:mb-0',
center: 'flex flex-col lg:grid grid-flow-col auto-cols-fr gap-8 xl:col-span-2',
right: 'mt-10 xl:mt-0',
label: 'text-sm font-semibold',
list: 'mt-6 space-y-4',
item: 'relative',
link: 'group text-sm flex items-center gap-1.5 focus-visible:outline-primary',
linkLeadingIcon: 'size-5 shrink-0',
linkLabel: 'truncate',
linkLabelExternalIcon: 'size-3 absolute top-0 text-dimmed inline-block'
},
variants: {
active: {
true: {
link: 'text-primary font-medium'
},
false: {
link: [
'text-muted hover:text-default',
'transition-colors'
]
}
}
}
}
}
})
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({
uiPro: {
footerColumns: {
slots: {
root: 'xl:grid xl:grid-cols-3 xl:gap-8',
left: 'mb-10 xl:mb-0',
center: 'flex flex-col lg:grid grid-flow-col auto-cols-fr gap-8 xl:col-span-2',
right: 'mt-10 xl:mt-0',
label: 'text-sm font-semibold',
list: 'mt-6 space-y-4',
item: 'relative',
link: 'group text-sm flex items-center gap-1.5 focus-visible:outline-primary',
linkLeadingIcon: 'size-5 shrink-0',
linkLabel: 'truncate',
linkLabelExternalIcon: 'size-3 absolute top-0 text-dimmed inline-block'
},
variants: {
active: {
true: {
link: 'text-primary font-medium'
},
false: {
link: [
'text-muted hover:text-default',
'transition-colors'
]
}
}
}
}
}
})
]
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
uiPro: {
footerColumns: {
slots: {
root: 'xl:grid xl:grid-cols-3 xl:gap-8',
left: 'mb-10 xl:mb-0',
center: 'flex flex-col lg:grid grid-flow-col auto-cols-fr gap-8 xl:col-span-2',
right: 'mt-10 xl:mt-0',
label: 'text-sm font-semibold',
list: 'mt-6 space-y-4',
item: 'relative',
link: 'group text-sm flex items-center gap-1.5 focus-visible:outline-primary',
linkLeadingIcon: 'size-5 shrink-0',
linkLabel: 'truncate',
linkLabelExternalIcon: 'size-3 absolute top-0 text-dimmed inline-block'
},
variants: {
active: {
true: {
link: 'text-primary font-medium'
},
false: {
link: [
'text-muted hover:text-default',
'transition-colors'
]
}
}
}
}
}
})
]
})