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'  
}

 

相关文章:

  • 2021-06-21
  • 2022-12-23
  • 2021-04-03
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2021-04-05
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案