当前位置:网站首页>更改小程序原生radio的颜色及大小
更改小程序原生radio的颜色及大小
2022-08-05 05:29:00 【weixin_43923808】
方式一:

<template>
<view class="content1">
<radio-group @change='change1' class="radio_css">
<radio value="2" disabled="{
{title=='bianji'}}" checked="{
{customerLevel==2}}"><text class="{
{customerLevel==2?'red':''}}"> A级-重要客户</text></radio>
<radio value="3" disabled="{
{title=='bianji'}}" class="radio2_css" checked="{
{customerLevel==3}}"><text class="{
{customerLevel==3?'red':''}}">B级-次重要客户</text></radio>
<radio value="4" disabled="{
{title=='bianji'}}" class="radio2_css" checked="{
{customerLevel==4}}"><text class="{
{customerLevel==4?'red':''}}">C级-普通客户</text></radio>
</radio-group>
</template>注意style 后面没有scoped
<style lang="less">
radio-group text {
font-size: 25rpx;
// color: #666666;
}
radio .wx-radio-input {
border-radius: 50%; /* 圆角 */
width: 24rpx;
border: 2rpx solid #5e5e5f;
height: 24rpx;
}
radio .wx-radio-input.wx-radio-input-checked {
border: none;
background: red;
}
radio .wx-radio-input.wx-radio-input-checked::before {
border-radius: 50%; /* 圆角 */
width: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx; /* 对勾大小 30rpx */
color: #fff; /* 对勾颜色 白色 */
background: red;
transform: translate(-50%, -50%) scale(1);
}
/*checkbox 整体大小 */
checkbox {
// width: 200rpx;
// height: 80rpx;
}
/*checkbox 选项框大小 */
checkbox .wx-checkbox-input {
width: 30rpx;
height: 30rpx;
border: 2rpx solid #5e5e5f;
}
/*checkbox选中后样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
background: #e83232;
border: 2rpx solid #e83232;
}
/*checkbox选中后图标样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
text-align: center;
font-size: 22rpx;
color: #fff;
background: transparent;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
</style>方式二:
<template>
<view class="content1">
<radio-group @change='change1' class="radio_css">
<radio value="2" disabled="{
{title=='bianji'}}" checked="{
{customerLevel==2}}"><text class="{
{customerLevel==2?'red':''}}"> A级-重要客户</text></radio>
<radio value="3" disabled="{
{title=='bianji'}}" class="radio2_css" checked="{
{customerLevel==3}}"><text class="{
{customerLevel==3?'red':''}}">B级-次重要客户</text></radio>
<radio value="4" disabled="{
{title=='bianji'}}" class="radio2_css" checked="{
{customerLevel==4}}"><text class="{
{customerLevel==4?'red':''}}">C级-普通客户</text></radio>
</radio-group>
</template>注意style 后面没有scoped
<style lang="less">
radio-group text {
font-size: 25rpx;
// color: #666666;
}
radio .wx-radio-input {
border-radius: 50%; /* 圆角 */
width: 24rpx;
border: 2rpx solid #5e5e5f;
height: 24rpx;
}
radio .wx-radio-input.wx-radio-input-checked {
border: none;
background: red;
}
radio .wx-radio-input.wx-radio-input-checked::before {
border-radius: 50%; /* 圆角 */
width: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx; /* 对勾大小 30rpx */
color: #fff; /* 对勾颜色 白色 */
background: red;
transform: translate(-50%, -50%) scale(1);
}
/*checkbox 整体大小 */
checkbox {
// width: 200rpx;
// height: 80rpx;
}
/*checkbox 选项框大小 */
checkbox .wx-checkbox-input {
width: 30rpx;
height: 30rpx;
border: 2rpx solid #5e5e5f;
}
/*checkbox选中后样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
border: 4rpx solid red !important; /* 外圈边框,选中状态颜色*/
background-color: white !important; /* 外圈边框与内圈实心圆间的内容的颜色,不设置就默认是上面的绿色*/
}
/*checkbox选中后图标样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
width: 60%;
height: 60%;
background: red; /* 内圈实心圆选中状态颜色*/
border-radius: 50%;
content: ''; /* 隐藏️*/
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
</style>
边栏推荐
猜你喜欢

【8】Docker中部署Redis

LeetCode practice and self-comprehension record (1)

LaTeX使用frame制作PPT图片没有标号

【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)

Collision, character controller, Cloth components (cloth), joints in the Unity physics engine

超简单的白鹭egret项目添加图片详细教程

Linux中安装Redis教程

淘宝客APP带自营商城本地生活CPS外卖优惠电影票话费更新渠道跟单生活特权V3

LeetCode中常用语言的一些基本方法记录

Drools规则引擎快速入门(一)
随机推荐
VRRP overview and experiment
NB-IOT智能云家具项目系列实站
MySQL的主从模式搭建
Cloud Computing Basics - Study Notes
Matplotlib plotting notes
Late night drinking, 50 classic SQL questions, really fragrant~
自营商城提高用户留存小技巧,商城对接小游戏分享
亚马逊美国站:马术头盔CPC认证标准要求
Drools规则引擎快速入门(一)
scikit-image图像处理笔记
Error correction notes for the book Image Processing, Analysis and Machine Vision
Come, come, let you understand how Cocos Creator reads and writes JSON files
Writing OpenCV in VSCode
BIO,NIO,AIO实践学习笔记(便于理解理论)
MyCat配置文件
盒子模型小练习
【FAQ】CCAPI Compatible EOS Camera List (Updated in August 2022)
图像处理、分析与机器视觉一书纠错笔记
单片机原理与应用复习
Nacos集群搭建