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

芯片 Vue 组件

芯片(标签)Vue 组件以小型块的形式表示复杂实体,例如联系人。它们可以包含照片、简短标题字符串和简要信息

芯片组件

包含以下组件

  • 芯片

芯片属性

名称类型默认值描述
colorsobject

包含 Tailwind CSS 颜色类对象的

colors.fillBgIosstring'bg-black bg-opacity-10 dark:bg-white dark:bg-opacity-10'
colors.fillBgMaterialstring'bg-md-light-secondary-container dark:bg-md-dark-secondary-container'
colors.fillTextIosstring'text-current'
colors.fillTextMaterialstring'text-md-light-on-secondary-container dark:text-md-dark-on-secondary-container'
colors.outlineBorderIosstring'border-black border-opacity-20 dark:border-white dark:border-opacity-20'
colors.outlineBorderMaterialstring'border-md-light-outline dark:border-md-dark-outline'
colors.outlineTextIosstring'text-current'
colors.outlineTextMaterialstring'text-md-light-on-surface dark:text-md-dark-on-surface'
componentstring'div'

组件的 HTML 元素

deleteButtonbooleanfalse

定义芯片是否具有额外的“删除”按钮

outlinebooleanfalse

使芯片轮廓

芯片事件

名称类型描述
deletefunction(e)

事件将在芯片删除按钮点击时触发

芯片插槽

名称描述
media

芯片媒体区域的内容(例如图标)

示例

Chips.vue
<template>
<k-page>
<k-navbar title="Chips" />
<k-block-title>Chips With Text</k-block-title>
<k-block strong-ios outline-ios>
<k-chip class="m-0.5">Example Chip</k-chip>
<k-chip class="m-0.5">Another Chip</k-chip>
<k-chip class="m-0.5">One More Chip</k-chip>
<k-chip class="m-0.5">Fourth Chip</k-chip>
<k-chip class="m-0.5">Last One</k-chip>
</k-block>
<k-block-title>Outline Chips</k-block-title>
<k-block strong-ios outline-ios>
<k-chip outline class="m-0.5"> Example Chip </k-chip>
<k-chip outline class="m-0.5"> Another Chip </k-chip>
<k-chip outline class="m-0.5"> One More Chip </k-chip>
<k-chip outline class="m-0.5"> Fourth Chip </k-chip>
<k-chip outline class="m-0.5"> Last One </k-chip>
</k-block>
<k-block-title>Contact Chips</k-block-title>
<k-block strong-ios outline-ios>
<k-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg"
/>
</template>
Jane Doe
</k-chip>
<k-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg"
/>
</template>
John Doe
</k-chip>
<k-chip class="m-0.5">
<template #media>
<img
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Adam Smith
</k-chip>
</k-block>
<k-block-title>Deletable Chips / Tags</k-block-title>
<k-block strong-ios outline-ios>
<k-chip class="m-0.5" delete-button @delete="onDelete">
Example Chip
</k-chip>
<k-chip class="m-0.5" delete-button @delete="onDelete">
<template #media>
<img
alt="avatar"
class="ios:h-7 material:h-6 rounded-full"
src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg"
/>
</template>
Adam Smith
</k-chip>
</k-block>
<k-block-title class="bg-b bg-b">Color Chips</k-block-title>
<k-block strong-ios outline-ios>
<k-chip
class="m-0.5"
:colors="{ fillBg: 'bg-red-500', fillText: 'text-white' }"
>
Red Chip
</k-chip>
<k-chip
class="m-0.5"
:colors="{ fillBg: 'bg-green-500', fillText: 'text-white' }"
>
Green Chip
</k-chip>
<k-chip
class="m-0.5"
:colors="{ fillBg: 'bg-blue-500', fillText: 'text-white' }"
>
Blue Chip
</k-chip>
<k-chip
class="m-0.5"
:colors="{ fillBg: 'bg-yellow-500', fillText: 'text-white' }"
>
Yellow Chip
</k-chip>
<k-chip
class="m-0.5"
:colors="{ fillBg: 'bg-pink-500', fillText: 'text-white' }"
>
Pink Chip
</k-chip>
<k-chip
class="m-0.5"
outline
:colors="{
outlineBorder: 'border-red-500',
outlineText: 'text-red-500',
}"
>
Red Chip
</k-chip>
<k-chip
class="m-0.5"
outline
:colors="{
outlineBorder: 'border-green-500',
outlineText: 'text-green-500',
}"
>
Green Chip
</k-chip>
<k-chip
class="m-0.5"
outline
:colors="{
outlineBorder: 'border-blue-500',
outlineText: 'text-blue-500',
}"
>
Blue Chip
</k-chip>
<k-chip
class="m-0.5"
outline
:colors="{
outlineBorder: 'border-yellow-500',
outlineText: 'text-yellow-500',
}"
>
Yellow Chip
</k-chip>
<k-chip
class="m-0.5"
outline
:colors="{
outlineBorder: 'border-pink-500',
outlineText: 'text-pink-500',
}"
>
Pink Chip
</k-chip>
</k-block>
</k-page>
</template>
<script>
import {
kPage,
kNavbar,
kNavbarBackLink,
kChip,
kBlock,
kBlockTitle,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kChip,
kBlock,
kBlockTitle,
},
setup() {
const onDelete = () => {
console.log('Delete Chip');
};
return {
onDelete,
};
},
};
</script>
代码许可证下 MIT.
2022 © Konsta UI by nolimits4web.