2023年了 还是有这个问题。。
view嵌套view,外部view的border属性导致内部出现缝隙怎么解决?<View className={styles.container}> <View className={styles.title} > </View> </View> .container { box-sizing: border-box; width: 550px; height: 70px; border: 2px solid green; background: red; .title { display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: center; height: 100%; background-color: gray; } } view 嵌套 view 的时候,外层 view 设置了 border 属性,在部分手机上内部就会出现缝隙: 背景色为红色时,上右下都能看到红色背景: [图片] 背景色透明时,也能看到白色缝隙: [图片] 按理说我设置的 flex: 1 和 height: 100% 不应该看到背景色才对。 当我把外层 view 的 border 删除时,就看不到红色的背景色了,外层 view 和内层 view 能完全重叠。 [图片] 这就导致了我外层 view 使用 border 后,内层 view 想完全填充背景色出现有缝隙的 BUG: [图片] 请问该怎么解决呢?
2023-09-07