【发布时间】:2019-07-15 16:15:42
【问题描述】:
我有来自计算变量样式的元素的动态样式。在计算属性样式中,我返回带有变量的 css。在其他浏览器中它工作得很好,但在 Safari 或 IE 中是内联样式
元素:
<button :style="styles" name="button"></button>
计算变量样式:
styles() {
return {
border: `${this.is('flat')?0:1}px solid ${_color.getColor(this.color,1)}`,
background: this.hoverx?_color.getColor(this.color,.1):'transparent',
color:_color.getColor(this.textColor,1) || _color.getColor(this.color,1)
}
}
这是它在浏览器中的样子
Chrome 中元素的内联 CSS:
Safari 中元素的内联 CSS
我发现当我预定义 css 属性时,一切正常
styles() {
return {
border: `${this.is('flat')?0:1}px solid red`,
background: this.hoverx?_color.getColor(this.color,.1):'transparent',
color:'red'
}
}
Safari中元素的内联css(删除变量后)
【问题讨论】:
标签: javascript css internet-explorer vue.js safari