Skip to content

Tag 标签

用于标注内容属性、元信息或操作状态,支持实心、描边、浅色和可关闭状态。

基础用法

vue
<template>
  <view class="demo-row">
    <lk-tag>默认</lk-tag>
    <lk-tag bg-color="var(--lk-color-success)" text-color="#fff">成功</lk-tag>
    <lk-tag bg-color="var(--lk-color-warning)" text-color="#fff">警告</lk-tag>
    <lk-tag bg-color="var(--lk-color-danger)" text-color="#fff">危险</lk-tag>
  </view>
</template>

样式与尺寸

vue
<template>
  <view class="demo-row">
    <lk-tag type="solid">实心</lk-tag>
    <lk-tag type="outline">描边</lk-tag>
    <lk-tag type="light">浅色</lk-tag>
    <lk-tag size="sm">小标签</lk-tag>
    <lk-tag size="lg">大标签</lk-tag>
  </view>
</template>

可关闭

vue
<template>
  <lk-tag closable @close="handleClose">Vue 3</lk-tag>
</template>

API

Props

参数说明类型默认值
type样式变体solid / outline / lightlight
size尺寸sm / md / lgmd
closable是否可关闭booleanfalse
disabled是否禁用booleanfalse
round是否胶囊圆角booleantrue
textColor自定义文字颜色string''
bgColor自定义背景色string''
customClass自定义类名string / object / array
customStyle自定义样式string / object

Events

事件名说明回调参数
click点击可用标签(event)
close点击可用关闭按钮(event)
click-disabled点击禁用标签(event)
close-disabled点击禁用标签的关闭按钮(event)

Slots

插槽名说明
default标签内容

发布说明

lk-tag 已补齐直接文档、Demo 与 showcase 视觉基线,可作为首批基础组件发布候选。

基于 MIT 协议开源 · 粤ICP备2022114240号-3

Tag 标签

正在连接预览服务...

请先运行 pnpm run dev:h5