<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>
|