element icon indicating copy to clipboard operation
element copied to clipboard

datepicker 不能自定义input的样式 希望新增样式属性

Open tandajun opened this issue 10 years ago • 8 comments

ElementUI version

OS/Browers version

Vue version

Reproduction Link

Steps to reproduce

What is Expected?

What is actually happening?

tandajun avatar Dec 01 '16 13:12 tandajun

可以自己写样式覆盖。

Leopoldthecoder avatar Dec 01 '16 13:12 Leopoldthecoder

我尝试利用类选择器 标签选择器 类选择器+子选择器 id选择器+子选择器 都不能实现覆盖原有样式(不是没加important的问题,是他并不能读取到我定义的样式 ~~)

.el-date-editor__editor{
    background: #324055;
    color: #eee;
  }
  .datePick > input{
    background: #324055;
    color: #eee;
  }
  #datePick > input{
    background: #324055;
    color: #eee;
  }
  input {
    background: #324055;
    color: #eee;
  }

以上写法都没能实现覆盖样式

tandajun avatar Dec 02 '16 00:12 tandajun

你的 style 标签是否加了 scoped?如果是的话,可以再写一个 style 标签,把你要覆盖的样式放进去。

Leopoldthecoder avatar Dec 02 '16 02:12 Leopoldthecoder

生效了 谢谢!可是我没懂,这个date-picker的模板不也是在style scoped的作用范围吗,为什么有scoped就不生效了呢??

tandajun avatar Dec 02 '16 03:12 tandajun

Vue 的 scoped 其实不好用,加的那条属性有时位置不对。

Leopoldthecoder avatar Dec 02 '16 03:12 Leopoldthecoder

恩 总之很谢谢啦~~

tandajun avatar Dec 02 '16 04:12 tandajun

vue的style标签加了scoped的话,组件相关的样式貌似无法本地模块化,请问除了不实用scoped这种做法,现在有解决方案吗

APIS-X avatar Dec 08 '16 04:12 APIS-X

首先,我没太懂为什么使用了scoped 组件就不能模块化;我之后有想过,应该可以用js去渲染出自己想要的效果(自己没实践~)

tandajun avatar Dec 08 '16 08:12 tandajun