更新记录

1.2.0(2024-11-19) 下载此版本

优化this

1.1.0(2024-03-29) 下载此版本

支持small大小格式、空心标签

1.0.2(2024-02-26) 下载此版本

新增圆形标签展示

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
×
钉钉小程序 快手小程序 飞书小程序 京东小程序
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
<template>
    <view class="tag-content">
        <view class="tag-title">small标签</view>
        <tag-list tabValueName="_id" size="small" tagShowName="category" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">small选中标签</view>
        <tag-list tabValueName="_id" size="small" tagShowName="category" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectedTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">small删除标签</view>
        <tag-list tabValueName="_id" size="small" tagShowName="category" :limit="2" type="delete" :tagList="tagList"
            @delete="handleDelete" @select="handleSelectTag" />

        <view class="tag-title">未选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectedTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">删除标签</view>
        <tag-list tabValueName="_id" tagShowName="category" :limit="2" type="delete" :tagList="tagList"
            @delete="handleDelete" @select="handleSelectTag" />

        <view class="tag-title">空心未选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="hollow" :limit="2" :tagList="tagList"
            @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">空心选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="hollow" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectedTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">空心删除标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="hollow" :limit="2" type="delete"
            :tagList="tagList" @delete="handleDelete" @select="handleSelectTag" />

        <view class="tag-title">圆形未选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="round" :limit="2" :tagList="tagList"
            @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">圆形选中标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="round" :limit="2" :type="type" :tagList="tagList"
            :selectedTagList="selectedTagList" @delete="handleDelete" @select="handleSelectTag" />
        <view class="tag-title">圆形删除标签</view>
        <tag-list tabValueName="_id" tagShowName="category" showType="round" :limit="2" type="delete" :tagList="tagList"
            @delete="handleDelete" @select="handleSelectTag" />
    </view>
</template>

<script>
    export default {
        data() {
            return {
                tabValueName: '_id',
                tagShowName: 'category',
                type: '', // delete【右上角出删除图标,无法选中,点击图标回调@delete】
                selectTagList: [],
                selectedTagList: [{
                    _id: "1",
                    category: "标签"
                }, {
                    _id: "2",
                    category: "标签"
                }, {
                    _id: "3",
                    category: "标签"
                }, {
                    _id: "4",
                    category: "标签"
                }, {
                    _id: "5",
                    category: "标签"
                }],
                tagList: [{
                    _id: "1",
                    category: "标签"
                }, {
                    _id: "2",
                    category: "标签"
                }, {
                    _id: "3",
                    category: "标签"
                }, {
                    _id: "4",
                    category: "标签"
                }, {
                    _id: "5",
                    category: "标签"
                }],
            };
        },
        methods: {
            /**
             * 选中、取消标签
             */
            handleSelectTag(seletedTagList) {
                this.selectTagList = seletedTagList
            },
            /**
             * 点击删除标签回调
             */
            handleDelete(data) {
                const {
                    item,
                    index
                } = data
                this.tagList.splice(index, 1)
            }
        },
    }
</script>
<style lang="scss">
    .tag-content {
        padding: 0 24rpx;

        .tag-title {
            font-size: 30rpx;
            font-weight: 600;
            margin: 24rpx 0;
        }
    }
</style>
参数 类型 默认值 描述
tagList Array [] 标签数据
selectTagList Array [] 选中标签数据
limit Number 1 可选标签可数【type 非 delete 生效】
tagShowName String 'category' 标签展示字段
tabValueName String '_id' 标签唯一标识 id
type String '' 标签类型:delete【可删除】
showType String normal 标签类型:round【圆形标签】hollow【空心标签】
size String normal 标签类型:small【小标签】

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问