• 小程序 之修改radio默认样式


    一、效果图

     二、代码

    /* 选中后的 背景样式 (红色背景 无边框 可根据UI需求自己修改) */
    
    radio .wx-radio-input.wx-radio-input-checked {
      border-color: #03a9f4;
      background: #03a9f4;
    }
    
    /* 自定义样式.... */
    
    radio .wx-radio-input {
      height: 40rpx;
       40rpx;
      margin-top: -4rpx;
      border-radius: 50%;
      border: 2rpx solid #999;
      background: transparent;
    }
    
    /* 选中后的 对勾样式 (白色对勾 可根据UI需求自己修改) */
    
    radio .wx-radio-input.wx-radio-input-checked::before {
      border-radius: 50%; /* 圆角 */
       40rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
      height: 40rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
      line-height: 40rpx;
      text-align: center;
      font-size: 30rpx; /* 对勾大小 30rpx */
      color: #fff; /* 对勾颜色 白色 */
      background: #f00;
      transform: translate(-50%, -50%) scale(1);
      -webkit-transform: translate(-50%, -50%) scale(1);
    }
    
    <radio-group class="radio-group weui-input" bindchange="radioChange">
          <radio style="margin-right:10rpx;" class="radio" wx:for-items="{{items}}" wx:for-index="i" wx:key="name" value="{{item.name}}" checked="{{item.checked}}">
              <image style="display:inline-block; 80rpx;height:30rpx;" src="https://www.boyuan.com/file/image/star{{3-i}}.gif"></image>
           </radio>
    </radio-group>
    

      

    const app = getApp();
    Page({
      data: {
        items: [
          { name: '', value: '3', checked: 'true'},
          { name: '', value: '2' },
          { name: '', value: '1' }
        ]
      },
      onLoad: function (options) {
        this.setData({
          itemid: options.itemid
        })
      },
      onShow: function () {
    
      },
      radioChange: function (e) {
        console.log('radio发生change事件,携带value值为:', e.detail.value)
      }
    })
    

      

  • 相关阅读:
    查看web访问日志各url shell
    分页公式
    编译hadoop2.6.0源码
    淘宝微信支付
    nodejs hot deployment
    nwjs
    css小技巧
    webpack babel 相关文章
    nodejs web framework
    swiper
  • 原文地址:https://www.cnblogs.com/yang-2018/p/11741831.html
Copyright © 2020-2023  润新知