[英]Vue.js: inline styles can't overwrite other styles
My code looks like this: 我的代码如下所示:
<div
class="title"
:style="{
fontSize: (object.text.length > 8 ? '0.7' : '1') + 'em'
}">
{{object.text}}
</div>
As you can see in this screenshot, this code doesn't overwrite other styles: https://i.stack.imgur.com/d7uGZ.png 如您在此屏幕截图中所见,此代码不会覆盖其他样式: https : //i.stack.imgur.com/d7uGZ.png
If I use "!important" flag, it doesn't add any styles at all 如果我使用“!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.