html52.com
我爱小程序-开发者交流社区

component 使用 radio 原生组件修改样式无效?

Page 页面中可以修改,但是 component 中无法修改

radio .wx-radio-input{ 
  /* 自定义样式.... */
  height: 22rpx; 
  width: 22rpx;
  margin-top: -8rpx;
  border-radius: 50%;
  border: 4rpx solid #000;
  background: transparent;
}
/* 选中后的 背景样式 (红色背景 无边框 可根据UI需求自己修改) */
radio .wx-radio-input.wx-radio-input-checked{
  // border: none;
}
/* 选中后的 对勾样式 (白色对勾 可根据UI需求自己修改) */
radio .wx-radio-input.wx-radio-input-checked::before{
  border-radius: 50%;/* 圆角 */
  width: 8rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
  height: 8rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
  background: #000;
  transform:translate(-50%, -50%) scale(1);
  -webkit-transform:translate(-50%, -50%) scale(1);
}

网友回复

Distance:

写在app.wxss或者写在对应导入该组件的父页面wxss中,然后定义addGlobalClass试一下?

Component({
  options: {
    // 基础库2.2.3开始支持
    addGlobalClass: true
  }
})

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付