uni-app中scss编写top:0;left:0;right:0;bottom:0;会变成inset:0;的Bug

uni-app中scss编写top:0;left:0;right:0;bottom:0;会变成inset:0;的Bug

开发环境 版本号 项目创建方式
Mac 11.16 HBuilderX
# 操作步骤:

```css
.modal {  
    position: fixed;  
    top: 0;  
    left: 0;  
    right: 0;  
    bottom: 0;  
}

预期结果:

.modal {  
    position: fixed;  
    top: 0;  
    left: 0;  
    right: 0;  
    bottom: 0;  
}

实际结果:

.modal{position:fixed;inset:0;}

bug描述:

scss写的样式

.modal {  
    position: fixed;  
    top: 0;  
    left: 0;  
    right: 0;  
    bottom: 0;  
}

编译打包之后成

.modal{position:fixed;inset:0;}

如果css写成

.modal {  
    position: fixed;  
    top: 0;  
    left: 0;  
    right: 0;  
    bottom: constant(safe-area-inset-bottom);  
    bottom: env(safe-area-inset-bottom);  
}

就不会变


更多关于uni-app中scss编写top:0;left:0;right:0;bottom:0;会变成inset:0;的Bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

解决了吗

更多关于uni-app中scss编写top:0;left:0;right:0;bottom:0;会变成inset:0;的Bug的实战教程也可以访问 https://www.itying.com/category-93-b0.html


如下代码可解决:
.modal {
top: 0;
left: 0;
right: 0;
bottom: 0 !important;
}

回到顶部