baotian
2024-06-04 b959135a1139fb66646523d92e5bd20c5910f283
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
<template>
    <view class="content">
        <!-- 顶部标题 -->
        <view class="title">{{title}}</view>
        <view class="detail">
            <view v-for="(item,index) in typeArr" :key="item.code" class="item" :class="activeIndex == index? 'active' : ''" @click="activeIndex = index">
                {{item.title}}
            </view>
        </view>
    </view>
</template>
<script>
import props from '../../../uni_modules/uview-ui/libs/config/props'
    export default {
        props: {
            title: {type: String,required: true},
            typeArr: {type: Array,required: true},
            status: {type: Number,required: true}
        },
        data() {
            return {
                activeIndex: 0,
            }
        },
        watch: {
            activeIndex(val) {
                this.$emit("update:status", this.typeArr[val].code)
            }
        }
    }
</script>
 
<style scoped lang="scss">
    .content {
        width: 96%;
        margin: 18rpx auto;
        .title {
            border-left: 6rpx solid #F18202;
            padding-left: 10rpx;
            box-sizing: border-box;
            font-size: 36rpx;
            margin-bottom: 10rpx;
        }
        .detail {
            box-sizing: border-box;
            width: 100%;
            display: flex;
            justify-content: space-around;
            box-sizing: border-box;
            .item {
                width: 30%;
                text-align: center;
                height: 80rpx;
                line-height: 80rpx;
                font-size: 40rpx;
                color: #000;
                background: #fff;
                border-radius: 10rpx;
            }
            .active {
                color: #fff;
                background: #F18202;
            }
        }
    }
</style>