-
Notifications
You must be signed in to change notification settings - Fork 288
fix(checkbox): #1323 修复checkboxGroup下,组件底部遮挡问题 #1343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
PR preview has been successfully built and deployed to https://vue-devui-pr-1343.surge.sh. |
|
由于增加了 sapn 标签,导致 transfer 组件自定义渲染内容的测试断言失败了 |
|
@xzxldl55 这个PR非常规范和清晰,点赞👍 |
|
@xzxldl55 测试用例失败了,看下是什么原因呢? |
我研究下,O.o |
|
PR preview has been successfully built and deployed to https://vue-devui-pr-1343.surge.sh. |
82f0d1f to
5265b06
Compare
|
PR preview has been successfully built and deployed to https://vue-devui-pr-1343.surge.sh. |
1 similar comment
|
PR preview has been successfully built and deployed to https://vue-devui-pr-1343.surge.sh. |
transfer最后一行针对 而因为我加了一层span在text标签上,所以这里它拿到的 [2] 元素是我加的那一个元素,而不是他自定义渲染设置了颜色的text(span)元素。 这里稍作修改,将获取text元素的dom操作改为更精确的 |
5265b06 to
8fbbb07
Compare
|
PR preview has been successfully built and deployed to https://vue-devui-pr-1343.surge.sh. |

修复过程
问题原因
在部分浏览器的渲染下 checkbox icon 会向下偏移1px,就拿文档例子说,16px盒子大小,checkbox icon也为 16 * 16,向下偏移1px,且最外部容器在分组(group)下,会添加
overflow: hidden;样式 【.devui-checkbox__wrap .devui-checkbox label】,所以呈现的就是显示不全的情况。修复思路
既然正常默认文档流的情况,checkbox - icon 在部分情况会向下偏移1px,那么我们让他不偏移即可。
这里我们将外部容器 label,修改为flex(原为block),并令子元素始终垂直居中
align-items: center;即可。其他带来问题修复:
flex-shrink: 1;令其会自动按照父级flex盒子大小缩减。flex-shrink: 0;让它不参与缩减,否则会被文字标签挤占宽度导致坍缩。修复效果: