<template>
	<view class="wenjuan-dan u-flex u-col-top">
		<view class="bianhao">
			{{index}}、
		</view>
		<view>
			<view class="timu-text">
				<text>单选</text>
				<text>{{item.quesName}}</text>
			</view>
			<view class="radio-box">
				<u-radio-group v-model="value" :wrap="true" @change="changeradio">
					<view v-for="(val, key) in radiolist" :key="key" v-if="item[val]">
						<u-radio :name="item[val]">
							<text class="item-text">{{item[val]}}</text>
						</u-radio>
					</view>
				</u-radio-group>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			index: {
				type: [Number, String],
				default: 0
			},
			item: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		data() {
			return {
				value: '',
				radiolist: ['answerA', 'answerB', 'answerC', 'answerD', 'answerE', 'answerF', 'answerG']
			}
		},
		onLoad() {

		},
		methods: {
			changeradio(e){
				this.$emit('changeradio',e)
			}
		}
	}
</script>

<style lang="scss">
	.wenjuan-dan {
		.radio-box {
			margin-top: 20rpx;

			.item-text {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: rgba(0, 0, 0, 0.88);
			}
		}

		.bianhao {
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #222222;
			line-height: 44rpx;
		}

		.timu-text {
			text:first-child {
				display: inline-block;
				width: 88rpx;
				line-height: 44rpx;
				background: #167FFF;
				border-radius: 6rpx;
				text-align: center;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #FFFFFF;
				margin-right: 12rpx;
			}

			text:last-child {
				line-height: 44rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #222222;
			}
		}
	}
</style>