html部分
<template>
<view>
<uni-forms :model-value="content" :label-width="110" :label-align="'right'">
<uni-forms-item label="申请人意见" name="applyOpinion" required class="item-radio-group">
<radio-group @change="radioChange" >
<label v-for="(item, index) in applyOpinions" :key="item.value">
<view>
<radio :value="item.value" :checked="index === applyOpinionIndex" :disabled="nodeDisabled"/>
<view class="radio-option-text">
{{item.name}}
</view>
</view>
</label>
</radio-group>
</uni-forms-item>
</uni-forms>
</view>
</template>
js部分
<script>
export default {
name: "consultation-outside-application-first-node",
props: ['processForm', 'nodeDisabled'],
data() {
return {
content: {},
applyOpinions: [
{
value: '无法安排会诊',
name: '无法安排会诊',
checked: 'true'
},
{
value: '外出会诊期间的医疗风险和个人人身安全由邀请医院和本人负责,同意前往。',
name: '外出会诊期间的医疗风险和个人人身安全由邀请医院和本人负责,同意前往。'
}
],
applyOpinionIndex: 0
};
},
mounted() {
this.content = this.processForm.formData.content
for(let i = 0; i < this.applyOpinions.length; i++) {
if (this.applyOpinions[i].value === this.content.applyOpinion) {
this.applyOpinionIndex = i;
break;
}
}
},
methods: {
radioChange: function(evt) {
for (let i = 0; i < this.applyOpinions.length; i++) {
if (this.applyOpinions[i].value === evt.detail.value) {
this.applyOpinionIndex = i;
break;
}
}
}
}
}
</script>
css部分
<style scoped lang="scss">
.item-radio-group {
display: flex;
flex-direction: row;
align-items: center;
}
.radio-option-text {
display: inline;
padding-left: 10px;
}
</style>