uniapp 1、checkbox 样式更改,2、checkbox-group多个选框

1、checkbox 样式更改

1<checkbox :checked="radioFlag" style="transform:scale(0.7)"/>

/*checkbox选中后样式  */
checkbox .wx-checkbox-input {
  border-radius: 50% !important;
}
/*checkbox选中后图标样式  */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
	color: #fff;
	background: #1F659A;;
	border: 1rpx solid #ffffff;
}

效果如下:
在这里插入图片描述
在这里插入图片描述

2<checkbox style="transform:scale(0.7)" disabled checked/>

	/*checkbox选中后样式  */
	checkbox .wx-checkbox-input, checkbox .uni-checkbox-input {
	  border-radius: 50% !important;
	  // border: 1rpx solid #979797;
	}
	/*checkbox选中后图标样式  */
	checkbox .wx-checkbox-input.wx-checkbox-input-checked,
	checkbox .uni-checkbox-input.uni-checkbox-input-checked{
		color: #fff!important;
		background: #0080C0;
		border: 1rpx solid #0080C0;
	}
	checkbox .wx-checkbox-input.wx-checkbox-input-checked::before,
	checkbox .uni-checkbox-input-checked::before {
		color: #fff!important;
	}

在这里插入图片描述

改后:
在这里插入图片描述


2、checkbox-group多个选框

<checkbox-group>
						<view class="card" v-for="(item, index) in deviceList" :key="index" @click="equipmentDetail(item)">
							<view class="top">
								<view class="top-l">
									<!-- <checkbox
										v-show="selectFlag"
										color="#FF8B1A"
										class="selectRadio"
										:value="item.aeratorRegulator.id"
										:checked="checkList.includes(item.aeratorRegulator.id)"
										@click.stop="checkRadioChange(item.aeratorRegulator.id)"
									/> -->
									<image v-show="!selectFlag" :src="$IMAGE_HOST +'/m-controller.svg'" mode=""></image>
									<span class="device">{{item.aeratorRegulator.id}}控制器 {{ `${item.aeratorRegulator.name}:${item.aeratorRegulator.eui}` }}</span>
								</view>
								<view class="top-r">
									<image :src="$IMAGE_HOST +'/right.svg'" mode=""></image>
								</view>
							</view>
							<view class="bottom">
								<span class="fishPond">{{ item.aquafarmName }} 鱼塘</span>
								<span class="service">{{item.service}}</span>
							</view>
						</view>
					</checkbox-group>




	/**
	 * 单选
	 */
    checkRadioChange(id) {
	  console.log('id')
	  console.log(id)
	  let that = this;
	  let _checkList = that.checkList
      if (_checkList.indexOf(id) == -1) {
        _checkList.push(id); //选中添加到数组里
      } else {
        _checkList.splice(_checkList.indexOf(id), 1); //取消
      }
	  console.log(_checkList)
	  this.$set(this, 'totalNum', _checkList.length)
    },
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值