当前位置:网站首页>[wechat applet: single or multiple styles, background color, rounded corners]
[wechat applet: single or multiple styles, background color, rounded corners]
2022-06-30 06:08:00 【Chang'an CC】
【 Wechat applet : The radio 、 Multiple styles , Background color , Round corners 】
The radio

<!-- Personalized service -->
<view class="addrBox-item">
<view class="addr-head">
<image src="/image/leftIcon.png" class="leftIconImg"></image>
<view class="item-title"> Personalized service </view>
</view>
<!-- -->
<view class="addr-box">
<!-- <radio checked='{
{check}}' id="radios" bindtap='radiocon'></radio> <label for="radios"> anonymous </label> -->
<!-- <view wx:for="{
{authData}}" wx:key="index" class="addr-item {
{item.selected?'selectedItem':''}}" data-index='{
{index}}' catchtap="checkboxChange">{
{item.title}}</view> -->
<radio-group bindchange="radioChange" class="radio_group">
<label class="check_label" wx:for="{
{radios}}" wx:key="index">
<view class="radioBox">
<radio value="{
{item.value}}" />
<view class="radionName">{
{item.name}}</view>
</view>
</label>
</radio-group>
</view>
</view>
// The radio
radios: [{
value: 'aa',
name: ' Support OEM ',
// checked: 'true'
},
{
value: 'bb',
name: ' A replacement '
},
]
// Radio buttons
radioChange(e) {
console.log('radio happen change event , carry value The value is :', e.detail.value)
const radios = this.data.radios;
for (let i = 0; i < radios.length; ++i) {
radios[i].checked = radios[i].value === e.detail.value
}
this.setData({
radios
})
},
/* Radio box style */
/* Initial style */
radio .wx-radio-input {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
}
/* Selected Background style ( background Frame ) */
radio .wx-radio-input.wx-radio-input-checked {
/* Check the size of the tick when it is selected , Don't exceed the size of the background */
width: 32rpx;
height: 32rpx;
background: #ff3b3b !important;
border-radius: 50%;
border: 1px solid #ff3b3b !important;
}
/* Selected Check style */
radio .wx-radio-input.wx-radio-input-checked::before {
/* Check the size of the tick when it is selected , Don't exceed the size of the background */
width: 32rpx;
height: 32rpx;
line-height: 32rpx;
text-align: center;
font-size: 28rpx;
/* Check size */
font-weight: 400;
color: #fff;
/* Check the color */
background: #ff3b3b !important;
border-radius: 50%;
border: 1px solid #ff3b3b !important;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
.radio_group {
display: flex;
}
.check_label {
display: flex;
align-items: center;
margin-right: 40rpx;
}
.radioBox {
display: flex;
}
.radionName {
margin-left: 4rpx;
}
multi-select

<!-- Personalized service -->
<view class="addrBox-item">
<view class="addr-head">
<image src="/image/leftIcon.png" class="leftIconImg"></image>
<view class="item-title"> Personalized service </view>
</view>
<!-- -->
<view class="addr-box">
<checkbox-group bindchange="Check" class="radio_group">
<label class="check_label" wx:for="{
{checkData}}" wx:key="index">
<view class="radioBox">
<checkbox value="{
{item.value}}" checked="{
{item.checked}}" />
</view>
<view class="radionName">{
{item.name}}</view>
</label>
</checkbox-group>
</view>
</view>
/* Radio box style */
/* Initial style */
checkbox .wx-checkbox-input {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
}
/* Selected Background style ( background Frame ) */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
/* Check the size of the tick when it is selected , Don't exceed the size of the background */
width: 32rpx;
height: 32rpx;
background: #ff3b3b !important;
border-radius: 50%;
border: 1px solid #ff3b3b !important;
}
/* Selected Check style */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
/* Check the size of the tick when it is selected , Don't exceed the size of the background */
width: 32rpx;
height: 32rpx;
line-height: 32rpx;
text-align: center;
font-size: 28rpx;
/* Check size */
font-weight: 400;
color: #fff;
/* Check the color */
background: #ff3b3b !important;
border-radius: 50%;
border: 1px solid #ff3b3b !important;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
// multi-select
checkData: [{
value: 'isOem',
name: ' Support OEM ',
// checked: 'true'
},
{
value: 'isDropShipping',
name: ' A replacement '
}
],
},
// multi-select
Check(e) {
console.log('checkbox happen change event , carry value The value is :', e.detail.value)
const checkData = this.data.checkData;
const values = e.detail.value;
for (let i = 0, lenI = checkData.length; i < lenI; ++i) {
checkData[i].checked = false;
for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
if (checkData[i].value === values[j]) {
checkData[i].checked = true;
break;
}
}
}
this.setData({
checkData
})
console.log(this.data.checkData);
if (this.data.checkData[0].checked) {
console.log(this.data.checkData[0].checked, ' Choose ');
} else {
}
},
边栏推荐
- Vscode configuration proxy
- 接口中方法详解
- Go common judgments
- CompletionService使用及原理(源码分析)
- 拼多多店铺搜索相关问题,为什么新品上架搜索不到
- Projet Web de déploiement du serveur Cloud
- [ansible series] fundamentals -01
- 583. deleting two strings - Dynamic Planning
- At the beginning of 2022, people who are ready to change jobs should pay attention to
- Summary of redis learning notes (I)
猜你喜欢
![[MD editing required] welcome to the CSDN markdown editor](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[MD editing required] welcome to the CSDN markdown editor

MySQL存储系统

Create priority queue

Shenzhou ares tx6 boot logo modification tutorial
![[GPU] basic operation](/img/76/6b22368e3addd30aef1dd2258ee49a.jpg)
[GPU] basic operation
![[OSPF] comparison between rip and OSPF](/img/72/00e3a05bc5de0e5a66b4675d030911.jpg)
[OSPF] comparison between rip and OSPF

Official win 10 image download

CompletableFuture从了解到精通,你想知道的这里都有

Dynamic programming -- gliding wing of the strange thief Kidd

接口中方法详解
随机推荐
电脑查看WiFi使用密码
Here comes the nearest chance to Ali
MySQL advanced SQL statement
[Alibaba cloud] student growth plan answers
8 ways to earn passive income
What indicators should safety service engineers pay attention to in emergency response?
观察者模式、状态模式在实际工作中的使用
Network basics
反編譯正常回編譯出現問題自己解决辦法
Related applications of priority queue
MySQL index
反编译正常回编译出现问题自己解决办法
Multithreading advanced level
数据读写:Unity中基于C#脚本实现数据读写功能
Record a problem tracking of excessive load
Title: enter two positive integers m and N to find their maximum common divisor and minimum common multiple
Learning automation ppt
网络基础知识
Mysql database learning notes - foreign keys, table connections, subqueries, and indexes for MySQL multi table queries
ES6扩展运算符(...)