1***@qq.com
1***@qq.com
  • 发布:2019-08-29 14:30
  • 更新:2021-01-09 22:21
  • 阅读:10646

uni-app 组件checkbox问题

分类:uni-app

在运用官方例子时发现,checkbox这个组件在小程序端是能走通,但是在h5页面时,组件不能打勾

<checkbox-group>  
    <label>  
        <checkbox value="cb" checked="true" color="#FFCC33" style="transform:scale(0.7)" />选中  
    </label>  
</checkbox-group>

是我自己用错了,还是怎样的??

2019-08-29 14:30 负责人:无 分享
已邀请:
东方飞鱼

东方飞鱼 - 大鱼吃小鱼,快鱼吃慢鱼

楼主是不是使用了colorUI?
colorUI的main.css里面有下面这样一段css,导致了checkbox .uni-checkbox-input::before不显示:

switch .wx-switch-input::before,  
radio.radio::before,  
checkbox .wx-checkbox-input::before,  
radio .wx-radio-input::before,  
switch .uni-switch-input::before,  
radio.radio::before,  
checkbox .uni-checkbox-input::before,  
radio .uni-radio-input::before {  
    display: none;  
}

解决方法:
要么写样式覆盖掉colorUI,要么自己用图标来模拟checkbox打勾

2***@qq.com

2***@qq.com

同问

dasensen

dasensen - 刘伟森

请问楼主解决了吗

4***@qq.com

4***@qq.com

switch .wx-switch-input::before,
radio.radio::before,
checkbox .wx-checkbox-input::before,
radio .wx-radio-input::before,
switch .uni-switch-input::before,
radio.radio::before,
/
checkbox .uni-checkbox-input::before,
/
radio .uni-radio-input::before {
display: none;
}

/ #ifndef H5 /
checkbox .uni-checkbox-input::before{
display: none;
}
/ #endif /

并将前面的CSS
/ #ifndef MP-ALIPAY /
/ #endif /
改成
/ #ifndef MP-ALIPAY || H5 /
/ #endif /

该问题目前已经被锁定, 无法添加新回复