请问各位大佬遇到这种情况怎么办:
<div ng-style='currentStyle'>
scope.currentStyle = {
"background": "-moz-linear-gradient(top, " + colorFrom + " 0%, " + colorTo + " 100%)",
"background": "-webkit-gradient(linear, left top, left bottom, color-stop(0%, " + colorFrom + "), color-stop(100%," + colorTo + "))",
"background": "-webkit-linear-gradient(top, " + colorFrom + " 0%," + colorTo + " 100%)",
"background": "-o-linear-gradient(top, " + colorFrom + " 0%," + colorTo + " 100%)",
"background": "-ms-linear-gradient(top, " + colorFrom + " 0%," + colorTo + " 100%)",
"background": "linear-gradient(to bottom, " + colorFrom + " 0%," + colorTo + " 100%)"
}
如果似乎拥有具有相同命名键的 javascript 对象是错误的,不是吗?那么如何制作渐变样式呢?
upd:我不知道,也许这样的javascript对象没有问题(在我的浏览器中工作),但是coffeescript编译器抱怨这样的代码,说:名为“背景”的多个对象文字属性