【问题标题】:Coffeescript Dashing widget backgroundcolorCoffeescript Dashing 小部件背景色
【发布时间】:2014-12-18 18:23:46
【问题描述】:

大家早上好,

我目前正在尝试更改我的小部件的背景颜色。不知何故,它只是行不通。

这是我的工作文件提供的内容:

return_array.push({value: value, label: row[0], color: color})

network = status_array[0..1] # This is pretty much return_array

send_event('network', {items: network[0]}) # sending data to the widget with data-id network

我使用的小部件是列表小部件。

这是我的 Coffeescript 文件的样子:

class Dashing.List extends Dashing.Widget

onData: (data) ->
  color = data.items.color
  $(@node).addClass "#{color}"

 ...

颜色代表“红色”或“绿色”

在我的 css 文件中,我的设置如下:

.green {
  background-color: $background-color;
}

.red {
 background-color: #f13a2a;
}

有没有人知道为什么它不会添加类?我可以提醒颜色并取回红色/绿色的值

【问题讨论】:

    标签: css coffeescript dashing


    【解决方案1】:

    试试

    onData: (data) =>
      color = data.items.color
      $(@node).addClass "#{color}"
    

    【讨论】:

      猜你喜欢
      • 2016-07-21
      • 1970-01-01
      • 2017-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-01
      • 1970-01-01
      相关资源
      最近更新 更多