js中使用css变量(vue)

html

<div class="test" :style="{ '--backgroundColor': backgroundColor }"></div>

js

css 

.test {
      background-color: var(--backgroundColor);
 }

 

posted @ 2023-10-25 11:02  Cynthia娆墨旧染  阅读(99)  评论(0编辑  收藏  举报