当前位置:网站首页>更改小程序原生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>
边栏推荐
- NB-IOT智能云家具项目系列实站
- Vim tutorial: vimtutor
- The size of the screen adaptation
- 字体样式及其分类
- 农场游戏果园系统+牧场养殖系统+广告联盟模式流量主游戏小程序APP V1
- The 25 best free games on mobile in 2020
- D39_ coordinate transformation
- 【FAQ】What is Canon CCAPI
- Network Troubleshooting Basics - Study Notes
- Complete mysql offline installation in 5 minutes
猜你喜欢
BIO, NIO, AIO practical study notes (easy to understand theory)
Nacos集群的搭建过程详解
滚动条问题,未解决
el-progress实现进度条颜色不同
docker部署完mysql无法连接
scikit-image图像处理笔记
Teach you simple steps to achieve industrial raspberries pie properly installed RS232 USB drive
Q 2020, the latest senior interview Laya soul, do you know?
亚马逊美国站:马术头盔CPC认证标准要求
NB-IOT智能云家具项目系列实站
随机推荐
农场游戏果园系统+牧场养殖系统+广告联盟模式流量主游戏小程序APP V1
LeetCode练习及自己理解记录(1)
Detailed explanation of ten solutions across domains (summary)
Configuration of routers and static routes
云计算基础-学习笔记
多行文本省略
淘宝客APP带自营商城本地生活CPS外卖优惠电影票话费更新渠道跟单生活特权V3
docker部署完mysql无法连接
网络协议基础-学习笔记
scikit-image image processing notes
lingo入门——河北省第三届研究生建模竞赛B题
txt文件英语单词词频统计
D41_buffer pool
D39_ coordinate transformation
系统基础-学习笔记(一些命令记录)
Network Troubleshooting Basics - Study Notes
摆脱极域软件的限制
BIO, NIO, AIO practical study notes (easy to understand theory)
ALC experiment
VS Code私有服务器部署(私有化)