当前位置:网站首页>[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 {
}
},
边栏推荐
- leetcode763. Divide letter interval
- [regular expression series] greedy and non greedy patterns
- Go common judgments
- 观察者模式、状态模式在实际工作中的使用
- ES6解构赋值
- Configure the user to log in to the device through telnet -- AAA local authentication
- There is a group of students' score {99, 85, 82, 63, 60}. To add a student's score, insert it into the score sequence and keep the descending order
- Title: enter two positive integers m and N to find their maximum common divisor and minimum common multiple
- [secretly kill little partner pytorch20 days] - [day4] - [example of time series data modeling process]
- MySQL高级SQL语句
猜你喜欢

Dynamic programming -- gliding wing of the strange thief Kidd

Golang's handwritten Web Framework

Tornado frame foundation

Mysql database learning notes - foreign keys, table connections, subqueries, and indexes for MySQL multi table queries

Prototype and prototype chain in JS

文件操作IO-Part1

从底层结构开始学习FPGA----RAM IP核及关键参数介绍

Dao -- a beautiful new world?

SparseArray

谁不想要一个自己的博客网站呢 - 搭建博客网站wordpress
随机推荐
数据读写:Unity中基于C#脚本实现数据读写功能
Strlen and sizeof, array length and string length, don't be silly
Summary of redis learning notes (I)
VLAN access mode
MySQL storage system
How to use unmarshaljson
ECS deployment web project
What indicators should safety service engineers pay attention to in emergency response?
inno setup 最简单的自定义界面效果
[exercise] basic practice letter graph of Blue Bridge Cup
8 ways to earn passive income
二十四、输入输出设备模型(串口/键盘/磁盘/打印机/总线/中断控制器/DMA和GPU)
IP TCP UDP network encryption suite format
飞升:基于中文分词器IK-2种自定义热词分词器构建方式showcase & 排坑showtime
MySQL数据库用户管理
At the age of 32, I fell into a middle-aged crisis and finally quit naked...
Common mistakes daily practice 01
谁不想要一个自己的博客网站呢 - 搭建博客网站wordpress
[secretly kill little partner pytorch20 days] - [day4] - [example of time series data modeling process]
Résoudre le problème de décompiler la compilation normale