陶杰
2025-01-13 efa9bfe98ba906e4c9b8f49c89f5da162a46bb0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<template>
    <view class="flex top-tabs" :class="[type]">
        <view class="top-tab t-grey p10" v-for="(item,index) of tabs" @tap="changeIndex(index)"
            :class="[''+index==flg?'active':'']">
            {{ item.name || item.label || '' }}
        </view>
    </view>
</template>
 
<script>
    export default {
        name: "top-tabs",
        data() {
            return {};
        },
        props: {
            tabs: {
                type: Array,
                default: []
            },
            flg: "",
            type: '',
        },
        methods: {
            changeIndex(index) {
                if (index == this.flg) {
 
                } else {
                    this.$emit('update:flg', index)
                    this.$emit('change', index)
                }
 
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .top-tabs.coupon {
        .top-tab {
            color: var(----topicdarkgray);
        }
 
        .top-tab.active {
            color: var(--topicolor);
        }
 
        .top-tab.active::before {
            background: var(--topicolor);
            bottom: 0rpx;
        }
    }
 
    .top-tabs {
        .top-tab {
            color: #ffffff;
            flex: 1;
            text-align: center;
        }
 
        .top-tab.active {
            color: #ffffff;
            font-weight: 600;
            // border-bottom: 8rpx solid #000;
            // 底部的线条
 
            font-weight: 600;
            font-size: 36rpx;
            line-height: 32rpx;
            text-align: center;
            font-style: normal;
            // padding: 0rpx;
            width: fit-content;
            position: relative;
        }
 
        .top-tab.active::before {
            position: absolute;
            content: " ";
            left: 16rpx;
            right: 16rpx;
            bottom: 8rpx;
            // width: 110rpx;
            height: 8rpx;
            // background: #04BA97;
            background: #ffffff;
 
            border-radius: 4rpx;
        }
    }
</style>