Chip Vue 组件
芯片(标记) Vue 组件在小块中表示复杂的实体,例如联系人。它们可以包含一张照片、一个简短标题字符串和一些简要信息
Chip 组件
包含以下组件
f7-chip
Chip 属性
道具 | 类型 | 默认值 | 说明 |
---|---|---|---|
<f7-chip> 属性 | |||
text | 字符串 | 芯片标签文本 | |
media | 字符串 | 芯片媒体的文本内容 | |
media-bg-color | 字符串 | 芯片媒体元素的背景色。其中一个 默认颜色 | |
media-text-color | 字符串 | 芯片媒体元素的文本颜色。其中一个 默认颜色 | |
可删除 | 布尔 | 假 | 定义芯片是否有额外的“删除”按钮 |
边框 | 布尔 | 假 | 让芯片有边框 |
工具提示 | 字符串 | 工具提示悬停/按下时显示的文本 | |
工具提示触发器 | 字符串 | 悬停 | 定义如何触发(打开)工具提示。可以是hover 、click 或manual |
<f7-chip>图标相关的属性 | |||
图标大小 | 字符串 数字 | 图标的像素大小 | |
图标颜色 | 字符串 | 默认颜色之一的图标颜色 | |
图标 | 字符串 | 自定义图标类 | |
icon-f7 | 字符串 | F7图标字体图标的名称 | |
icon-material | 字符串 | 材质图标字体图标的名称 | |
icon-ios | 字符串 | 在使用iOS主题的情况下要使用的图标。包含由冒号分隔的图标族和图标名称,例如f7:house | |
icon-md | 字符串 | 当使用MD主题时使用的图标。包含由冒号分隔的图标族和图标名称,例如material:home |
芯片事件
事件 | 说明 |
---|---|
<f7-chip>事件 | |
点击 | 芯片点击时触发事件 |
删除 | 芯片删除按钮点击时触发事件 |
芯片插槽
Chip Vue 组件有用于自定义元素的附加插槽
text
- 元素将插入芯片文本标签的位置default
- (与text
相同)media
- 元素将插入芯片的媒体元素
示例
chips.vue
<template>
<f7-page>
<f7-navbar title="Chips"></f7-navbar>
<f7-block-title>Chips With Text</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip text="Example Chip"></f7-chip>
<f7-chip text="Another Chip"></f7-chip>
<f7-chip text="One More Chip"></f7-chip>
<f7-chip text="Fourth Chip"></f7-chip>
<f7-chip text="Last One"></f7-chip>
</f7-block>
<f7-block-title>Outline Chips</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip outline text="Example Chip"></f7-chip>
<f7-chip outline text="Another Chip"></f7-chip>
<f7-chip outline text="One More Chip"></f7-chip>
<f7-chip outline text="Fourth Chip"></f7-chip>
<f7-chip outline text="Last One"></f7-chip>
</f7-block>
<f7-block-title>Icon Chips</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip text="Add Contact" media-bg-color="blue">
<template #media>
<f7-icon ios="f7:plus_circle" md="material:add_circle" />
</template>
</f7-chip>
<f7-chip text="London" media-bg-color="green">
<template #media>
<f7-icon ios="f7:compass" md="material:location_on" />
</template>
</f7-chip>
<f7-chip text="John Doe" media-bg-color="red">
<template #media>
<f7-icon ios="f7:person" md="material:person" />
</template>
</f7-chip>
</f7-block>
<f7-block-title>Contact Chips</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip text="Jane Doe">
<template #media>
<img src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg" />
</template>
</f7-chip>
<f7-chip text="John Doe">
<template #media>
<img src="https://cdn.framework7.io/placeholder/people-100x100-3.jpg" />
</template>
</f7-chip>
<f7-chip text="Adam Smith">
<template #media>
<img src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg" />
</template>
</f7-chip>
<f7-chip text="Jennifer" media-bg-color="pink" media="J"></f7-chip>
<f7-chip text="Chris" media-bg-color="yellow" media-text-color="black" media="C"></f7-chip>
<f7-chip text="Kate" media-bg-color="red" media="K"></f7-chip>
</f7-block>
<f7-block-title>Deletable Chips / Tags</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip text="Example Chip" deleteable @delete="deleteChip"></f7-chip>
<f7-chip
text="Chris"
media="C"
media-bg-color="orange"
deleteable
@delete="deleteChip"
></f7-chip>
<f7-chip text="Jane Doe" deleteable @delete="deleteChip">
<template #media>
<img src="https://cdn.framework7.io/placeholder/people-100x100-9.jpg" />
</template>
</f7-chip>
<f7-chip text="One More Chip" deleteable @delete="deleteChip"></f7-chip>
<f7-chip
text="Jennifer"
media-bg-color="pink"
media="J"
deleteable
@delete="deleteChip"
></f7-chip>
<f7-chip text="Adam Smith" deleteable @delete="deleteChip">
<template #media>
<img src="https://cdn.framework7.io/placeholder/people-100x100-7.jpg" />
</template>
</f7-chip>
</f7-block>
<f7-block-title>Color Chips</f7-block-title>
<f7-block strong-ios outline-ios>
<f7-chip text="Red Chip" color="red"></f7-chip>
<f7-chip text="Green Chip" color="green"></f7-chip>
<f7-chip text="Blue Chip" color="blue"></f7-chip>
<f7-chip text="Orange Chip" color="orange"></f7-chip>
<f7-chip text="Pink Chip" color="pink"></f7-chip>
<f7-chip outline text="Red Chip" color="red"></f7-chip>
<f7-chip outline text="Green Chip" color="green"></f7-chip>
<f7-chip outline text="Blue Chip" color="blue"></f7-chip>
<f7-chip outline text="Orange Chip" color="orange"></f7-chip>
<f7-chip outline text="Pink Chip" color="pink"></f7-chip>
</f7-block>
</f7-page>
</template>
<script>
import { f7Navbar, f7Page, f7BlockTitle, f7Chip, f7Block, f7Icon, f7 } from 'framework7-vue';
import $ from 'dom7';
export default {
components: {
f7Navbar,
f7Page,
f7BlockTitle,
f7Chip,
f7Block,
f7Icon,
},
methods: {
deleteChip(e) {
const target = e.target;
f7.dialog.confirm('Do you want to delete this tiny demo Chip?', () => {
$(target).parents('.chip').remove();
});
},
},
};
</script>