🔥 遇见我们的新项目 t0ggles - 您终极的项目管理工具! 🔥

卡片 Vue 组件

卡片,以及 列表视图,是包含和组织信息的另一种好方法。卡片包含独特的相关数据,例如,一张关于单个主题的照片、文本和链接。卡片通常是通往更复杂和详细的信息的入口点。

卡片组件

以下组件包含在内

  • 卡片

卡片属性

名称类型默认值描述
颜色对象

带有 Tailwind CSS 颜色类别的对象

colors.bgIos字符串'bg-ios-light-surface-1 dark:bg-ios-dark-surface-1'
colors.bgMaterial字符串'bg-md-light-surface-1 dark:bg-md-dark-surface-1'
colors.footerTextIos字符串'text-black text-opacity-55 dark:text-white dark:text-opacity-55'
colors.footerTextMaterial字符串'text-md-light-on-surface-variant dark:text-md-dark-on-surface-variant'
colors.outlineIos字符串'border-black border-opacity-20 dark:border-white dark:border-opacity-20'
colors.outlineMaterial字符串'border-md-light-outline dark:border-md-dark-outline'
colors.textIos字符串''
colors.textMaterial字符串'text-md-light-on-surface dark:text-md-dark-on-surface'
组件字符串'div'

组件的 HTML 元素

contentWrap布尔值true

使用额外的带有填充的元素包装卡片内容

contentWrapPadding字符串'p-4'

内容包装填充(如果启用了 contentWrap

页脚字符串

卡片页脚的内容

footerDivider布尔值false

启用页脚和内容之间的分隔线

页眉字符串

卡片页眉的内容

headerDivider布尔值false

启用页眉和内容之间的分隔线

边距字符串'm-4'

Tailwind CSS 边距类

轮廓布尔值未定义

创建卡片轮廓。覆盖 outlineIosoutlineMaterial

outlineIos布尔值false

在 iOS 主题中创建卡片轮廓

outlineMaterial布尔值false

在 Material 主题中创建卡片轮廓

凸起布尔值未定义

创建凸起卡片。覆盖 raisedIosraisedMaterial

raisedIos布尔值false

在 iOS 主题中创建凸起卡片

raisedMaterial布尔值false

在 Material 主题中创建凸起卡片

卡片插槽

名称描述
页脚

卡片页脚的内容

页眉

卡片页眉的内容

示例

Cards.vue
<template>
<k-page>
<k-navbar title="Cards" />
<k-block-title :with-block="false">Simple Cards</k-block-title>
<k-card>
This is a simple card with plain text, but cards can also contain their
own header, footer, list view, image, or any other element.
</k-card>
<k-card header="Card header" footer="Card footer">
Card with header and footer. Card headers are used to display card titles
and footers for additional information or just for custom actions.
</k-card>
<k-card>
Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet.
Mauris aliquet magna justo.
</k-card>
<k-block-title :with-block="false">Outline Cards</k-block-title>
<k-card outline>
This is a simple card with plain text, but cards can also contain their
own header, footer, list view, image, or any other element.
</k-card>
<k-card outline header="Card header" footer="Card footer">
Card with header and footer. Card headers are used to display card titles
and footers for additional information or just for custom actions.
</k-card>
<k-card outline>
Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet.
Mauris aliquet magna justo.{' '}
</k-card>
<k-block-title :with-block="false">Outline With Dividers</k-block-title>
<k-card
outline
header="Card header"
footer="Card footer"
header-divider
footer-divider
>
Card with header and footer. Card headers are used to display card titles
and footers for additional information or just for custom actions.
</k-card>
<k-block-title :with-block="false">Raised Cards</k-block-title>
<k-card raised>
This is a simple card with plain text, but cards can also contain their
own header, footer, list view, image, or any other element.
</k-card>
<k-card raised header="Card header" footer="Card footer">
Card with header and footer. Card headers are used to display card titles
and footers for additional information or just for custom actions.
</k-card>
<k-card raised>
Another card. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse feugiat sem est, non tincidunt ligula volutpat sit amet.
Mauris aliquet magna justo.{' '}
</k-card>
<k-block-title :with-block="false">Card With List View</k-block-title>
<k-card>
<k-list nested class="-m-4">
<k-list-item href title="Link 1" />
<k-list-item href title="Link 2" />
<k-list-item href title="Link 3" />
<k-list-item href title="Link 4" />
<k-list-item href title="Link 5" />
</k-list>
</k-card>
<k-block-title :with-block="false">Styled Cards</k-block-title>
<div class="lg:grid lg:grid-cols-2">
<k-card outline>
<template #footer>
<div class="flex justify-between material:hidden">
<k-link>Like</k-link>
<k-link>Read more</k-link>
</div>
<div
className="flex justify-start ios:hidden space-x-2 rtl:space-x-reverse"
>
<k-button rounded inline> Like </k-button>
<k-button rounded inline outline> Read more </k-button>
</div>
</template>
<div
class="ios:-mx-4 ios:-mt-4 h-48 p-4 flex items-end text-white ios:font-bold bg-cover bg-center material:rounded-xl mb-4 material:text-[22px]"
:style="{
'background-image':
'url(https://cdn.framework7.io/placeholder/nature-1000x600-3.jpg)',
}"
>
Journey To Mountains
</div>
<div class="text-gray-500 mb-3">Posted on January 21, 2021</div>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies
efficitur vitae non felis. Phasellus quis nibh hendrerit...
</p>
</k-card>
<k-card>
<template #footer>
<div class="flex justify-between material:hidden">
<k-link>Like</k-link>
<k-link>Read more</k-link>
</div>
<div
className="flex justify-start ios:hidden space-x-2 rtl:space-x-reverse"
>
<k-button rounded inline> Like </k-button>
<k-button rounded inline outline> Read more </k-button>
</div>
</template>
<div
class="ios:-mx-4 ios:-mt-4 h-48 p-4 flex items-end text-white ios:font-bold bg-cover bg-center material:rounded-xl mb-4 material:text-[22px]"
:style="{
'background-image':
'url(https://cdn.framework7.io/placeholder/people-1000x600-6.jpg)',
}"
>
Lorem Ipsum
</div>
<div class="text-gray-500 mb-3">Posted on January 21, 2021</div>
<p>
Quisque eget vestibulum nulla. Quisque quis dui quis ex ultricies
efficitur vitae non felis. Phasellus quis nibh hendrerit...
</p>
</k-card>
</div>
</k-page>
</template>
<script>
import {
kPage,
kNavbar,
kNavbarBackLink,
kCard,
kBlockTitle,
kList,
kListItem,
kLink,
kButton,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kCard,
kBlockTitle,
kList,
kListItem,
kLink,
kButton,
},
};
</script>
代码许可证为 MIT.
2022 © Konsta UI by nolimits4web.