微信小程序radio的樣式修改
代碼
html部分
<radio-group bindchange="radioChange" name="sex"> <label class="" wx:for="{{sex}}" wx:key="{{item.value}}" style="margin-right:40rpx;"> <radio value="{{item.value}}" checked="true"/>{{item.text}} </label> </radio-group>
css部分
radio .wx-radio-input.wx-radio-input-checked { border-color: #cc0000; background: #cc0000; } radio .wx-radio-input { height: 35rpx; width: 35rpx; margin-top: -4rpx; border-radius: 50%; border: 2rpx solid #999; background: transparent; } radio .wx-radio-input.wx-radio-input-checked::before { border-radius: 50%; /* 圓角 */ width: 35rpx; /* 選中后對勾大小,不要超過背景的尺寸 */ height: 35rpx; /* 選中后對勾大小,不要超過背景的尺寸 */ line-height: 35rpx; text-align: center; font-size: 28rpx; /* 對勾大小 30rpx */ color: #fff; /* 對勾顏色 白色 */ background: #cc0000; transform: translate(-50%, -50%) scale(1); -webkit-transform: translate(-50%, -50%) scale(1); }
js 部分
Page({ data: { sex:[ {text:'男',value:1}, {text:'女',value:2}, ] } })
如果您的問題還未解決可以聯系站長付費協助。

有問題可以加入技術QQ群一起交流學習
本站vip會員 請加入無憂模板網 VIP群(50604020) PS:加入時備注用戶名或昵稱
普通注冊會員或訪客 請加入無憂模板網 技術交流群(50604130)
客服微信號:15898888535
聲明:本站所有文章資源內容,如無特殊說明或標注,均為采集網絡資源。如若內容侵犯了原著者的合法權益,可聯系站長刪除。