index.vue
953 Bytes
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
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-08-30 13:54:06
* @FilePath: /data-table/src/components/RadioField/index.vue
* @Description: 文件描述
-->
<template>
<div class="radio-field-page">
<div class="label">{{ item.label }}<span v-if="item.required"> *</span></div>
<van-field :name="item.key">
<template #input>
<van-radio-group v-model="item.value">
<van-radio v-for="x in item.options" :key="index" :name="x.key" icon-size="1rem"
style="margin-bottom: 0.25rem;">{{ x.value }}</van-radio>
</van-radio-group>
</template>
</van-field>
</div>
</template>
<script setup>
const props = defineProps({
item: Object
})
</script>
<style lang="less" scoped>
.radio-field-page {
.label {
padding: 1rem 1rem 0 1rem;
font-size: 0.9rem;
font-weight: bold;
span {
color: red;
}
}
}
</style>