Quellcode durchsuchen

通过修改样式控制选择整个选项框即可选中选项

htc vor 2 Tagen
Ursprung
Commit
b92ba4108a
1 geänderte Dateien mit 27 neuen und 18 gelöschten Zeilen
  1. 27 18
      components/QuestionItem/index3.vue

+ 27 - 18
components/QuestionItem/index3.vue

@@ -13,17 +13,24 @@
 						placement="column"
 						@change="e=>radioChange(e,ua.assessmentMethod,item.id)"
 					>
-						<view class="la_item" v-for="(pre,idx) in ua.questionOption" :key="idx">
-							<u-radio
-								:label="pre.questionOption"
-								:name="pre.questionOption"
-								activeColor="#33A7A7"
-								size="36rpx"
-								iconSize="32rpx"
-								labelColor="#002846"
-								labelSize="28rpx"
-							></u-radio>
-						</view>
+						<u-radio
+							v-for="(pre,idx) in ua.questionOption" 
+							:key="idx"
+							:label="pre.questionOption"
+							:name="pre.questionOption"
+							activeColor="#33A7A7"
+							size="36rpx"
+							iconSize="32rpx"
+							labelColor="#002846"
+							labelSize="28rpx"
+							:custom-style="{
+								'padding': '0 24rpx',
+								'background': '#FFFFFF',
+								'border-radius': '24rpx',
+								'margin-top': '10rpx',
+								'width': '100%'
+							}"
+						></u-radio>
 					</u-radio-group>
 				</view>
 			</view>
@@ -33,7 +40,10 @@
 
 <script>
 	export default {
-		name: "QuestionItem",
+		name: "QuestionItem",
+		options: {
+			styleIsolation: 'shared'
+		},
 		props: {
 			item: {
 				type: Object,
@@ -69,7 +79,7 @@
 	}
 </script>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 	.li_box{
 		margin-top: 20rpx;
 		.lb_title{
@@ -98,11 +108,10 @@
 			.lb_answers{
 				width: 100%;
 				margin-top: 20rpx;
-				.la_item{
-					padding: 31rpx 24rpx;
-					background: #FFFFFF;
-					border-radius: 24rpx;
-					margin-top: 10rpx;
+				
+				::v-deep .u-radio__text {
+					width: 100% !important;
+					padding: 31rpx 0 !important;
 				}
 			}
 		}