繁体   English   中英

Vue.js:内联样式无法覆盖其他样式

[英]Vue.js: inline styles can't overwrite other styles

我的代码如下所示:

<div
    class="title"
    :style="{
    fontSize: (object.text.length > 8 ? '0.7' : '1') + 'em'
}">
    {{object.text}}
</div>

如您在此屏幕截图中所见,此代码不会覆盖其他样式: https : //i.stack.imgur.com/d7uGZ.png

如果我使用“!important”标志,则根本不添加任何样式

<div
  class="title"
  :style="{
    fontSize: (object.text.length > 8 ? '0.7' : '1') + 'em !important'
}">
  {{object.text}}
</div>

类“ title”来自其他框架,所以我刚刚更改了此类的名称,现在可以正常使用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM