js中使用css变量(vue)

html

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

js

css 

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

 

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