1
PC-20250623MANY\Administrator
2025-07-22 9ec3bd6e8d7357927533d8966f882cb5d28b3e0f
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
    <div class="checkBox">
        <van-radio-group v-model="radio" @input="onInput">
            <van-radio v-for="(item, index) in list" :key="index" :name="item.type">
                {{ item.name }}
                <template #icon="props">
                    <div class="select" :class="props.checked ? 'selected' : ''">
                        <div class="checked"></div>
                    </div>
                </template>
            </van-radio>
        </van-radio-group>
    </div>
</template>
 
<script>
import { RadioGroup, Radio } from 'vant';
export default {
    props: {
        list: {
            type: Array,
            default: []
        },
        initRadio: {
            type: Number,
            default: 0
        }
    },
    components: {
        [RadioGroup.name]: RadioGroup,
        [Radio.name]: Radio,
    },
    data() {
        return {
            radio: 0
        }
    },
    computed: {
        // initRadio(val){
        //     console.log(val)
        // }
    },
    mounted() {
        let type = this.$route.query.type || this.list[0].type;
        this.radio = Number(type);
    },
    methods: {
        onInput() {
            this.$emit('checked', this.radio)
        }
    }
}
</script>
 
<style lang="scss" scoped>
.checkBox {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 26px;
    color: #000;
 
    .select {
        width: 30px;
        height: 30px;
        box-sizing: border-box;
        border-radius: 50%;
        margin-right: 15px;
        border: 2px solid #868D9A;
        box-sizing: border-box;
        padding: 1px;
 
        .checked {
            width: 100%;
            height: 100%;
            border-radius: 50%;
        }
    }
 
    .selected {
        @include themify() {
            background: themed("color_main");
        }
 
        .checked {
            @include themify() {
                color: themed("color_main");
            }
        }
    }
 
    ::v-deep .van-radio__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        height: auto !important;
    }
 
    .van-radio {
        font-size: 26px !important;
        color: #000 !important;
        margin-top: 42px;
    }
 
    ::v-deep .van-radio__label {
        font-size: 26px !important;
 
        @include themify() {
            color: themed("text_color");
        }
    }
}
</style>