PricingPlans 가격 계획
응답 그리드 레이아웃에 가격책정 계획 목록을 표시합니다.
Usage
PricingPlans 구성 요소는 기본 슬롯 또는 plans prop를 사용하여 [PricingPlanxph03xxph04x) 구성 요소 목록을 표시하는 유연한 레이아웃을 제공합니다.
<template>
<UPricingPlans>
<UPricingPlan
v-for="(plan, index) in plans"
:key="index"
v-bind="plan"
/>
</UPricingPlans>
</template>
그리드 기둥은 계획 수에 따라 자동으로 계산되며, 이것은
plans prop에서 작동하지만 기본 슬롯에서도 작동합니다.Plans 계획
plans prop을 PricingPlan 구성 요소의 속성이 있는 오브젝트 배열로 사용합니다.
Solo
Tailored for indie hackers.
$249
- One developer
- Lifetime access
Startup
Best suited for small teams.
$499
- Up to 5 developers
- Everything in Solo
Organization
Ideal for larger teams and organizations.
$999
- Up to 20 developers
- Everything in Startup
<script setup lang="ts">
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans :plans="plans" />
</template><script setup lang="ts">
import { ref } from 'vue'
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans :plans="plans" />
</template>방향 지정
orientation prop를 사용하여 PricingPlans.default의 방향을 horizontal로 변경합니다.
Solo
Tailored for indie hackers.
- One developer
- Lifetime access
$249
Startup
Best suited for small teams.
- Up to 5 developers
- Everything in Solo
$499
Organization
Ideal for larger teams and organizations.
- Up to 20 developers
- Everything in Startup
$999
<script setup lang="ts">
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans orientation="vertical" :plans="plans" />
</template><script setup lang="ts">
import { ref } from 'vue'
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans orientation="vertical" :plans="plans" />
</template>기본 슬롯 대신
plans 소품을 사용하면 계획의 orientation가 자동으로 반전되고 horizontal가 vertical로 또는 그 반대도 마찬가지입니다.컴팩트
계획 중 하나가 더 나은 시각적 균형을 위해 크기를 조정할 때 compact Prop을 사용하여 계획 사이의 패딩을 줄입니다.
Solo
Tailored for indie hackers.
$249
- One developer
- Lifetime access
Startup
Best suited for small teams.
$499
- Up to 5 developers
- Everything in Solo
Organization
Ideal for larger teams and organizations.
$999
- Up to 20 developers
- Everything in Startup
<script setup lang="ts">
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
scale: true,
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans compact :plans="plans" />
</template><script setup lang="ts">
import { ref } from 'vue'
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
scale: true,
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans compact :plans="plans" />
</template>Scale 크기
계획 중 하나가 더 나은 시각적 균형을 위해 크기를 조정할 때 scale 소품을 사용하여 계획 사이의 간격을 조정합니다.
Solo
Tailored for indie hackers.
$249
- One developer
- Lifetime access
Startup
Best suited for small teams.
$499
- Up to 5 developers
- Everything in Solo
Organization
Ideal for larger teams and organizations.
$999
- Up to 20 developers
- Everything in Startup
<script setup lang="ts">
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
scale: true,
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans scale :plans="plans" />
</template><script setup lang="ts">
import { ref } from 'vue'
import type { PricingPlanProps } from '@nuxt/ui'
const plans = ref<PricingPlanProps[]>([
{
title: 'Solo',
description: 'Tailored for indie hackers.',
price: '$249',
features: [
'One developer',
'Lifetime access'
],
button: {
label: 'Buy now'
}
},
{
title: 'Startup',
description: 'Best suited for small teams.',
price: '$499',
scale: true,
features: [
'Up to 5 developers',
'Everything in Solo'
],
button: {
label: 'Buy now'
}
},
{
title: 'Organization',
description: 'Ideal for larger teams and organizations.',
price: '$999',
features: [
'Up to 20 developers',
'Everything in Startup'
],
button: {
label: 'Buy now'
}
}
])
</script>
<template>
<UPricingPlans scale :plans="plans" />
</template>examples 예제
이러한 예제에서는 Nuxt Content를 사용하지만 구성 요소는 모든 콘텐츠 관리 시스템과 통합 할 수 있습니다.
Page 페이지 내
페이지의 PricingPlans 구성요소를 사용하여 가격책정 페이지를 생성합니다.
pages/pricing/index.vue
<script setup lang="ts">
const { data: plans } = await useAsyncData('plans', () => queryCollection('plans').all())
</script>
<template>
<UPage>
<UPageHero title="Pricing" />
<UPageBody>
<UContainer>
<UPricingPlans :plans="plans" />
</UContainer>
</UPageBody>
</UPage>
</template>
이 예제에서는
plans가 @nuxt/content 모듈에서 queryCollection를 사용하여 가져올 수 있습니다.API 파일
Props (### Props)
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
plans | PricingPlanProps[] | |
orientation | 'horizontal' | "horizontal" | "vertical"The orientation of the pricing plans. |
compact | false | boolean When |
scale | false | boolean When |
ui | { base?: any; } |
Slots
| Slot | Type |
|---|---|
badge | { ui: object; } |
title | {} |
description | {} |
price | {} |
discount | {} |
billing | { ui: object; } |
features | {} |
button | { ui: object; } |
header | {} |
body | {} |
footer | {} |
tagline | {} |
terms | {} |
default | {} |
Theme 테마
app.config.ts
export default defineAppConfig({
ui: {
pricingPlans: {
base: 'flex flex-col gap-y-8',
variants: {
orientation: {
horizontal: 'lg:grid lg:grid-cols-[repeat(var(--count),minmax(0,1fr))]',
vertical: ''
},
compact: {
false: 'gap-x-8'
},
scale: {
true: ''
}
},
compoundVariants: [
{
compact: false,
scale: true,
class: 'lg:gap-x-13'
}
]
}
}
})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: {
pricingPlans: {
base: 'flex flex-col gap-y-8',
variants: {
orientation: {
horizontal: 'lg:grid lg:grid-cols-[repeat(var(--count),minmax(0,1fr))]',
vertical: ''
},
compact: {
false: 'gap-x-8'
},
scale: {
true: ''
}
},
compoundVariants: [
{
compact: false,
scale: true,
class: 'lg:gap-x-13'
}
]
}
}
})
]
})Changelog 파일
No recent changes