微信小程序修改radio的样式

        <radio-group bindchange="radioChange">
          <label class="flRlist" wx:for="{
  {productList}}" wx:key="index">           
            <view class="flName">{
  {item.name}}</view>
            <view class="flZT">
              <radio color="#74bfe7" style="transform:scale(0.8);" value="{
  {item.value}}" checked="true"  class="flxzys"/>
            </view>
          </label>
        </radio-group>
radio .wx-radio-input{width:35rpx;height:35rpx;border-radius:50%;border:2rpx solid #000;background:0 0}
radio .wx-radio-input.wx-radio-input-checked{width:35rpx;height:35rpx;border:2rpx solid #000;background-color:#fff!important}
radio .wx-radio-input.wx-radio-input-checked::before{width:35rpx;height:35rpx;border-radius:50%;width:20rpx;height:20rpx;line-height:20rpx;text-align:center;font-size:0rpx;color:transparent;background:#000;transform:translate(-50%,-50%) scale(1)}
  data: {
    productList: [
      {value: 'USA', name: '美国'},
      {value: 'CHN', name: '中国', checked: 'true'},
      {value: 'BRA', name: '巴西'},
      {value: 'JPN', name: '日本'},
      {value: 'ENG', name: '英国'},
      {value: 'FRA', name: '法国'},
    ]
  },

二:

<view class="flZT">
              <radio color="#74bfe7" style="transform:scale(0.8);" value="{
  {item.value}}" checked="true"  class="flxzys"/>
            </view>

注解:
bindchange:有变化执行事件
wx:for-items:表示对{ {items}}进行循环
<radio>中的color属性:主要设置选中之后图标颜色
<radio>中的style属性:这里主要用来展示图标的大,scale缩放
<radio>中的value属性:主要用于事件bindchange执行之后能获取到值
<radio>中的checked属性:设置默认值
 


  //单选
  radioChange:function(e){
    //获取单选数据
    console.log(e.detail.value)//输出的是{
  {item.name}}的值

相关推荐

  1. 程序修改checkbox和radio样式

    2023-12-07 08:40:04       42 阅读
  2. 程序修改placeholder样式

    2023-12-07 08:40:04       41 阅读
  3. 程序-组件样式隔离

    2023-12-07 08:40:04       28 阅读
  4. 程序修改标题

    2023-12-07 08:40:04       49 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-07 08:40:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-07 08:40:04       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-07 08:40:04       82 阅读
  4. Python语言-面向对象

    2023-12-07 08:40:04       91 阅读

热门阅读

  1. 【使用uniapp完成微信小程序的图片下载到本机】

    2023-12-07 08:40:04       64 阅读
  2. Vue实战(十):对数组数据的拆分和分组合并

    2023-12-07 08:40:04       56 阅读
  3. 有基础转Go语言学习笔记(2. 基本数据结构篇)

    2023-12-07 08:40:04       49 阅读
  4. C++的文件读写

    2023-12-07 08:40:04       69 阅读
  5. C++11改进观察者模式

    2023-12-07 08:40:04       57 阅读
  6. [leetcode 差分数组] 拼车 M

    2023-12-07 08:40:04       58 阅读
  7. ElasticSearch 查询优化手段有哪些?

    2023-12-07 08:40:04       50 阅读
  8. 持续集成部署-k8s-高级调度-亲和力

    2023-12-07 08:40:04       40 阅读
  9. 图论|841钥匙和房间

    2023-12-07 08:40:04       61 阅读
  10. 安全众测-内网渗透常用的工具和命令

    2023-12-07 08:40:04       60 阅读