更新记录

1.0.0(2023-05-03)

完成


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
app-vue app-nvue
钉钉小程序 快手小程序 飞书小程序 京东小程序
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari

uni.scss(按项目实际颜色)

$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
$uni-color-info: #909399; //默认色
$uni-color-disabled: #c0c4cc; //禁止色
$uni-color-default: #dcdfe6; 

依赖yll1024335892-ayi-icon组件

参数

参数 说明 类型 可选值 默认值
modelValue / v-model 选中的下标值或者列表项的 value 值 string / number
height 高度 number 80
list 列表 array
loop 是否循环显示 boolean true
fill 选项卡是否填充 boolean false
gutter 选项卡间隔 number 20
border 是否带有下边框 boolean true
color 激活的字体及浮标颜色 string 主色
un-color 未激活的字体颜色 string
background-color 背景色 string #fff
show-dropdown 是否显示下拉框 boolean false

方法

事件名称 说明 参数
refresh 特殊情况下,重新刷新布局

示例

基础用法

<template>
    <ayi-tabs v-model="active" :list="list"></ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active = ref<number>(0);

    const list = ref<any[]>([
        {
            label: "数码"
        },
        {
            label: "家电"
        },
        {
            label: "母婴"
        },
        {
            label: "潮牌"
        }
    ]);
</script>

居中

配置 justify 参数

<template>
    <ayi-tabs v-model="active" :list="list" justify="center"></ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active = ref<number>(0);

    const list = ref<any[]>([
        {
            label: "数码"
        },
        {
            label: "家电"
        },
        {
            label: "母婴"
        },
        {
            label: "潮牌"
        }
    ]);
</script>

填充

配置 fill 参数

<template>
    <ayi-tabs v-model="active" :list="list" fill></ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active = ref<number>(0);

    const list = ref<any[]>([
        {
            label: "数码"
        },
        {
            label: "家电"
        },
        {
            label: "母婴"
        },
        {
            label: "潮牌"
        }
    ]);
</script>

自定义颜色

<template>
    <ayi-tabs v-model="active" :list="list" color="red" un-color="blue" background-color="#f7f7f7"></ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active = ref<number>(0);

    const list = ref<any[]>([
        {
            label: "数码"
        },
        {
            label: "家电"
        },
        {
            label: "母婴"
        },
        {
            label: "潮牌"
        }
    ]);
</script>

下拉框

配置 show-dropdown 参数及添加 dropdown 插槽

<template>
    <ayi-tabs v-model="active" :list="list" show-dropdown>
        <template #dropdown>
            <view class="dropdown">
                <ayi-text
                    :value="item.label"
                    v-for="item in list"
                    :key="item.value"
                    :margin="10"
                ></ayi-text>
            </view>
        </template>
    </ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active = ref<number>(0);

    const list = ref<any[]>([
        {
            label: "数码"
        },
        {
            label: "家电"
        },
        {
            label: "母婴"
        },
        {
            label: "潮牌"
        }
    ]);
</script>

<style lang="scss" scoped>
    .dropdown {
        background-color: #ddd;
        padding: 20rpx;
    }
</style>

更改绑定值

list 中不存在 value 的情况下,会以数组的下标返回。否则返回 value 值

<template>
    <ayi-tabs v-model="active2" :list="list2"></ayi-tabs>
</template>

<script lang="ts" setup>
    import { ref } from "vue";

    const active2 = ref<string>("b");

    const list2 = ref<any[]>([
        {
            label: "数码",
            value: "a"
        },
        {
            label: "家电",
            value: "b"
        },
        {
            label: "母婴",
            value: "c"
        },
        {
            label: "潮牌",
            value: "d"
        }
    ]);
</script>

隐私、权限声明

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

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

插件不采集任何数据

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

许可协议

MIT协议

暂无用户评论。

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