您的位置:首页 > Web前端 > Vue.js

vue里修改iview组件的样式不生效

2019-04-08 16:19 921 查看

问题背景: 使用的是vue框架+iview框架
问题描述: 比如使用iview种组件Date-picker,想把这个组件里的classname=ivu-input的border-radius改为0,不生效,书写如下,写在有scoped的style里

<style scoped>
.ivu-input{
border-radius:0px !important;  //有时候会不生效
}
</style>

问题原因: 不晓得,偶尔遇到,也没有深究,有兴趣的同学可以去研究下;
解决方法: 再追加一个style,不加scoped,表示全局引用;

1.如果你是希望全部都去掉边框,那么就直接写成如下,直接修改样式
<style>
.ivu-input{
border-radius:0px !important;
}
.ivu-select-selection{
border-radius:0px !important;
}
</style>
2.如果只是当前页面修改,不希望影响其他页面,
则在.ivu-input前边加一个可标识是本页的class或者id即可
<style>
.dataStatistics .ivu-input{
border-radius:0px !important;
}
.dataStatistics  .ivu-select-selection{
border-radius:0px !important;
}
</style>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: