前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >微信小程序修改checkbox组件默认样式

微信小程序修改checkbox组件默认样式

作者头像
w候人兮猗
发布2020-07-01 17:27:37
5670
发布2020-07-01 17:27:37
举报
文章被收录于专栏:w候人兮猗的博客

关于

  • UI设计的多选框的样式十分好看,微信自带的样式丑到爆,这时候就需要我们自定义checkbox的默认样式了。

正文

  • checkbox组件,默认的组件样式很丑,有的时候需要根据业务UI实现自己的checkbox。先给<checkbox class="checkbox"/>一个.checkbox类名
代码语言:javascript
复制
.checkbox .wx-checkbox-input {
  border-radius: 32rpx; /* 圆角 */
  width: 32rpx; /* 背景的宽 */
  height: 32rpx; /* 背景的高 */
  border: 2px solid rgba(255, 129, 92, 1);
}

.checkbox .wx-checkbox-input-disabled {
  border-radius: 32rpx; /* 圆角 */
  width: 32rpx; /* 背景的宽 */
  height: 32rpx; /* 背景的高 */
  background: #f3f3f3;
  border: 1px solid rgba(201, 201, 201, 1);
}

.checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: rgba(255, 129, 92, 1);
}

.checkbox  .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 32rpx;
  height: 32rpx;
  line-height: 32rpx;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}

.checkbox .wx-checkbox-input {
  border-radius: 32rpx; /* 圆角 */
  width: 32rpx; /* 背景的宽 */
  height: 32rpx; /* 背景的高 */
  border: 1px solid rgba(255, 129, 92, 1);
}

.checkbox .wx-checkbox-input-disabled {
  border-radius: 32rpx; /* 圆角 */
  width: 32rpx; /* 背景的宽 */
  height: 32rpx; /* 背景的高 */
  background: #f3f3f3;
  border: 1px solid rgba(201, 201, 201, 1);
}

.checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: rgba(255, 129, 92, 1);
}

.checkbox  .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 32rpx;
  height: 32rpx;
  line-height: 32rpx;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019年4月26日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 正文
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档