uniapp-前后端开发app-系列外传01小组件工具篇

2 篇文章 0 订阅
2 篇文章 0 订阅

checkgroup做圆形单选框

因为有很多东西要整理,所以先出这种模块组件篇,偏实用

test.vue

<template>
	<view class="content">
		<view class="testyan">

			<view class="flowouter">

				<checkbox-group class="flowoutergroup">

					<view class="flowouterspace" v-for="(items,index) in testList" :key="index"
						@tap="choseChange(index)">

						<view class="checktext">{{items.name}}</view>
						<checkbox class="rightChickstyle" :value="items.values" :checked="items.checked"></checkbox>
					</view>

				</checkbox-group>

			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {

				testList: [{
						name: "第一天",
						values: "第一天",
						checked: false,
					},
					{
						name: "第七天",
						values: "第七天",
						checked: false,
					},
					{
						name: "第八天",
						values: "第八天",
						checked: false,

					},
					{
						name: "第十天",
						values: "第十天",
						checked: false,
					}
				],
			}
		},
		onLoad() {

		},
		methods: {

			choseChange(index) {
				this.testList.forEach(v => v.checked = false)
				this.testList[index].checked = true

			}
		}
	}
</script>

<style lang="less" lang="scss">
	.content {
		position: relative;
		padding: 20rpx;
		width: 100vw;

		.testyan {
			width: 100%;
			display: flex;
			flex-direction: column;
			padding: 20rpx;
			background: #dddddd;
			border-radius: 20rpx;

			.flowouter {
				margin-top: 15rpx;
				display: flex;
				justify-content: center;
				align-items: center;

				.flowoutergroup {
					width: 100%;
					display: flex;
					flex-direction: column;

					.flowouterspace {
						height: 100rpx;
						background: #FFFFFF;
						opacity: 0.6;
						padding-left: 22rpx;
						padding-top: 22rpx;
						padding-bottom: 22rpx;
						border-radius: 20rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-bottom: 15rpx;
						color: black;

						.rightChickstyle {
							margin-right: 10rpx;
						}
					}
				}
			}
		}
	}
</style>




App.vue

<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
  /* 在这里修改checkbox样式*/
	page,view,text,swiper,swiper-item,image,navigator{
	   padding :0;
	   margin :0;
	   box-sizing:border-box;
	}
	.uni-checkbox-input{
			background-color: #ffffff !important;   //背景
			/* border-color: #ffffff !important;   //边框 */
			/* 如果打开边框就会是透明的*/
			color: #C3B7A3 !important;   //对勾颜色
		}
	uni-checkbox .uni-checkbox-input {
			border-radius: 80rpx !important;
      /* 这里是方形选择框变圆形*/
		}	

</style>

成型图片

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值