Skip to content

标签 Tag

标签组件。

兼容性

  • 兼容:✅
  • 不兼容:❌
  • 未知:❔
H5安卓苹果微信支付宝百度抖音QQ快手飞书京东
小红书鸿蒙360华为快应用快应用联盟

插件市场地址

DCloud 插件市场地址

基础使用

  • 通过 text 属性设置文本内容。
vue
<template>
    <pure-tag text="标签"></pure-tag>
</template>

图标

  • 通过 icon 属性设置图标。
vue
<template>
    <pure-tag text="目标" icon="__mubiao"></pure-tag>
</template>

关闭按钮

  • 通过 showClose 设置是否显示关闭按钮。
  • 通过 closeIcon 自定义关闭按钮图标。
vue
<template>
    <pure-tag text="目标" icon="__mubiao" showClose closeIcon="__shibai1"></pure-tag>
</template>

主题

  • 通过添加辅助类实现。
vue
<template>
    <pure-tag class="pure-tag-primary" text="主要"></pure-tag>
    <pure-tag class="pure-tag-success" text="成功"></pure-tag>
    <pure-tag class="pure-tag-danger" text="危险"></pure-tag>
    <pure-tag class="pure-tag-warning" text="警告"></pure-tag>
    <pure-tag class="pure-tag-info" text="信息"></pure-tag>
</template>

圆角标签

  • 通过添加辅助类实现。
vue
<template>
    <pure-tag class="pure-tag-primary pure-tag-round" text="圆角标签"></pure-tag>
</template>

朴素标签

  • 通过添加辅助类实现。
vue
<template>
    <pure-tag class="pure-tag-primary pure-tag-plain" text="朴素"></pure-tag>
    <pure-tag class="pure-tag-success pure-tag-plain" text="朴素"></pure-tag>
    <pure-tag class="pure-tag-danger pure-tag-plain" text="朴素"></pure-tag>
    <pure-tag class="pure-tag-warning pure-tag-plain" text="朴素"></pure-tag>
    <pure-tag class="pure-tag-info pure-tag-plain" text="朴素"></pure-tag>
</template>

浅色背景

  • 通过添加辅助类实现。
vue
<template>
    <pure-tag class="pure-tag-primary pure-tag-light" text="标签"></pure-tag>
    <pure-tag class="pure-tag-success pure-tag-light" text="标签"></pure-tag>
    <pure-tag class="pure-tag-danger pure-tag-light" text="标签"></pure-tag>
    <pure-tag class="pure-tag-warning pure-tag-light" text="标签"></pure-tag>
    <pure-tag class="pure-tag-info pure-tag-light" text="标签"></pure-tag>
</template>

边框

  • 通过添加辅助类实现。
vue
<template>
    <pure-tag class="pure-tag-primary pure-tag-light pure-tag-border" text="标签"></pure-tag>
    <pure-tag class="pure-tag-success pure-tag-light pure-tag-border" text="标签"></pure-tag>
    <pure-tag class="pure-tag-danger pure-tag-light pure-tag-border" text="标签"></pure-tag>
    <pure-tag class="pure-tag-warning pure-tag-light pure-tag-border" text="标签"></pure-tag>
    <pure-tag class="pure-tag-info pure-tag-light pure-tag-border" text="标签"></pure-tag>
</template>

Props

属性名说明类型默认值可选值版本
hoverClassviewhover-classString"pure-hover"-+1.0.0
text标签文本String--+1.0.0
icon图标名称,同图标组件(Icon)的 name 属性,参考Stringundefined-+1.0.0
iconMode图片图标的裁剪模式,同图标组件(Icon)的 mode 属性,参考Stringundefined-+1.0.0
showClose是否显示关闭按钮Booleanfalsetrue+1.0.0
closeIcon关闭图标名称,同图标组件(Icon)的 name 属性,参考String__cuo-+1.0.0
closeIconMode关闭图片图标的裁剪模式,同图标组件(Icon)的 mode 属性,参考Stringundefined-+1.0.0
disabled禁用状态Booleanfalsetrue+1.0.0
disabledClass禁用类名Stringpure-disabled-+1.0.0

Event

事件名说明回调参数版本
onClick点击事件-+1.0.0
close关闭按钮点击事件-+1.0.0

Slots

名称说明参数版本
default默认(文本内容区域)-+1.0.0
icon图标-+1.0.0
close关闭按钮-+1.0.0

基于 MIT 许可发布