Vue 中, 修改Iview form表单的默认样式

 

使用过Iview的应该都知道,iview的样式是锁定了的,不像bootstrap那样可以直接修改,刚开始的时候,使用iview的时候,想修改字体大小和颜色,真的很迷,网上的那些方法也试过,可惜无效

这里我是使用的 vue2 + iview3

比如我现在要修改Iview 的form表单中label标签的字体颜色,默认颜色和class 如下

Vue 中, 修改Iview form表单的默认样式

之前我在网上搜的时候,大多方法都是如下

方法一:在vue组件中,可惜无效

<style scoped>
  .formRegister > .ivu-form > .ivu-form-item-label{
      color: white !important;
  }
</style>

方法二:自定义css,可惜也无效

<style>
  .formRegister > .ivu-form > .ivu-form-item-label{
      color: white !important;
  }
</style>

然后我在思否上提问,有人建议用 >>> 来修改,代码如下

<style scoped>
   .formRegister >>> .ivu-form-item-label{
    color: white;
  }
</style>

最后字体颜色修改为白色了

Vue 中, 修改Iview form表单的默认样式