Fork me on GitHub

style里面设置变量

 

1、在style里面添加变量

*适用于组件统一调整样式

//html 示例

1 <div class="headerBox">
2     <p class="headerContent"></p>    
3 </div>

//css 示例

.headerBox{
  --bgc:#ffffff;  
}
.headerContent{
  background-color:var(--bgc);  
}

 

2、style内联样式中添加方法

//html 示例

<div :style="getStyle()"></div>

//medthods 示例

getStyle(){
  return 'color:red'  
}

 

posted @ 2020-06-09 17:08  `A+  阅读(2212)  评论(0编辑  收藏  举报