ng-docs / ng-docs.github.io

Angular 官方文档中文版预编译网站
https://angular.cn
Other
103 stars 22 forks source link

Angular9动态修改css变量 #153

Closed ZD-code closed 4 years ago

ZD-code commented 4 years ago

我在全局的css文件中设置了:root{--bottom: 10px;},然后在一个点击事件中,修改--bottom为auto;我该如何做???

wszgrcy commented 4 years ago

element.style.setProperty('--bottom', 'auto'); ???

ZD-code commented 4 years ago

element.style.setProperty('-bottom','auto'); ??? 谢谢