(h5)html环境下js如何操作sass里的变量及calc 使用sass变量

scss文件里

:root {
    --height-primary: 240px;  //--height-primary  :变量名,css3有规则
}
$header: var(--height-primary); //用var来盛放变量名

.el-table{
    height: calc(100vh - 101px - #{$header});
}

 

js里更改

if(this.isDB){
       document.getElementsByTagName('body')[0].style.setProperty('--height-primary','64px');
 } else {
       document.getElementsByTagName('body')[0].style.setProperty('--height-primary','0px');
}

 

转 : https://www.jb51.cc/css/868154.html

https://www.cnblogs.com/llcdbk/p/14044176.html

 

posted @ 2021-11-16 10:32  与f  阅读(276)  评论(0编辑  收藏  举报