uniapp中uview组件库丰富的tab标签

目录

[Tag 标签](#Tag 标签)

基本使用

#自定义主题

#圆形标签

#镂空标签

#镂空带背景色

#自定义尺寸

#可关闭标签

#带图片和图标

[#单选标签 和 多选标签](#单选标签 和 多选标签)


Tag 标签

tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景

基本使用

  • 通过type参数设置主题类型,默认为primary

  • 属性text设置标签内容

    <u-tag text="标签" plain size="mini" type="warning"></u-tag>

#自定义主题

复制代码
<u-tag text="标签"></u-tag>
<u-tag text="标签" type="warning"></u-tag>
<u-tag text="标签"type="success"></u-tag>
<u-tag text="标签" type="error"></u-tag>

#圆形标签

  • 类似胶囊形状

    <u-tag text="标签" plain shape="circle"></u-tag>
    <u-tag text="标签" type="warning" shape="circle"></u-tag>

#镂空标签

复制代码
<u-tag text="标签" plain > </u-tag>
<u-tag text="标签" type="warning" plain></u-tag>
<u-tag text="标签" type="success" plain></u-tag>
<u-tag text="标签" type="error" plain></u-tag>

#镂空带背景色

  • 添加plainFill属性镂空带背景色

    <u-tag text="标签" plain > </u-tag>
    <u-tag text="标签" type="warning" plain plainFill></u-tag>
    <u-tag text="标签" type="success" plain plainFill></u-tag>
    <u-tag text="标签" type="error" plain plainFill></u-tag>

#自定义尺寸

  • size属性为您提供了三种规格的标签大小,默认中等。

    <u-tag text="标签" plain size="mini"></u-tag>
    <u-tag text="标签" type="warning"></u-tag>
    <u-tag text="标签" type="success" plain size="large"></u-tag>

#可关闭标签

  • tag在右上角提供了删除标签的样式

    <u-tag text="标签" size="mini" closable :show="close1" @close="close1 = false"></u-tag>
    <u-tag text="标签" type="warning" closable :show="close2" @close="close2 = false"></u-tag>
    <u-tag text="标签" type="success" plain size="large"
    closable :show="close3" @close="close3 = false"></u-tag>

    <script> export default { data() { return { close1: true, close2: true, close3: true, radios: [{ checked: true }, { checked: false }, { checked: false } ], checkboxs: [{ checked: true }, { checked: false }, { checked: false } ] } }, } </script>

#带图片和图标

复制代码
<u-tag text="标签" size="mini" icon="map" plain></u-tag>
<u-tag text="标签" type="warning" icon="tags-fill"></u-tag>
<u-tag text="标签" type="success" plain size="large"
icon="https://cdn.uviewui.com/uview/example/tag.png"></u-tag>

#单选标签 和 多选标签

  • 我们为您提供了单选和多选的事件,您可以在事件中获取参数列表

    <template> <view class="u-page__tag-item" v-for="(item, index) in radios" :key="index"> <u-tag :text="`选项${index + 1}`" :plain="!item.checked" type="warning" :name="index" @click="radioClick"> </u-tag> </view> <view class="u-page__tag-item" v-for="(item, index) in checkboxs" :key="index"> <u-tag :text="`选项${index + 1}`" :plain="!item.checked" type="warning" :name="index" @click="checkboxClick"> </u-tag> </view> </template> <script> export default { data() { return { radios: [{ checked: true }, { checked: false }, { checked: false } ], checkboxs: [{ checked: true }, { checked: false }, { checked: false } ] } }, methods: { radioClick(name) { this.radios.map((item, index) => { item.checked = index === name ? true : false }) }, checkboxClick(name) { this.checkboxs[name].checked = !this.checkboxs[name].checked } } } </script> <style lang="scss"> .u-page__tag-item { margin-right: 20px; } </style>
相关推荐
2501_916007474 小时前
苹果手机iOS应用管理全指南与隐藏功能详解
android·ios·智能手机·小程序·uni-app·iphone·webview
2501_915106327 小时前
全面理解 iOS 帧率,构建从渲染到系统行为的多工具协同流畅度分析体系
android·ios·小程序·https·uni-app·iphone·webview
2501_916008899 小时前
iOS 能耗检测的工程化方法,构建多工具协同的电量分析与性能能效体系
android·ios·小程序·https·uni-app·iphone·webview
济南壹软网络科技有限公司9 小时前
综合社交服务平台的技术架构与实践:构建高可用、多端覆盖的互动生态
uni-app·php·开源源码·陪玩陪聊h5
2501_9159214310 小时前
重新理解 iOS 的 Bundle Id 从创建、管理到协作的工程策略
android·ios·小程序·https·uni-app·iphone·webview
2501_9151063210 小时前
当 altool 退出历史舞台,iOS 上传链路的演变与替代方案的工程实践
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张10 小时前
Transporter 的局限与替代路径,iOS 上传流程在多平台团队中的演进
android·ios·小程序·https·uni-app·iphone·webview
lwprain10 小时前
uniapp使用uniview-plus性能问题处理
uni-app
00后程序员张10 小时前
Python 抓包工具全面解析,从网络监听、协议解析到底层数据流捕获的多层调试方案
开发语言·网络·python·ios·小程序·uni-app·iphone
AH_HH12 小时前
UniApp H5 代理失效的终极替代方案
uni-app