Dashing を使用してダッシュボード用の新しいウィジェットを作成します。サーバー REST では、16 進数コードの色を受け取り、これをウィジェットの背景色に動的に使用したいと考えています。
私の仕事は、正しい色を受け取ります。しかし、背景色を動的に変更することはできません。
SCSS コード :
$background-color: #008000; /*default color*/
$title-color: rgba(255, 255, 255, 1);
$moreinfo-color: rgba(255, 255, 255, 0.7);
.widget-state {
background: $background-color;
font-size: 65px;
font-weight: bold;
}
そして私のウィジェットのコーヒースクリプト
ready: ->
# This is fired when the widget is done being rendered
onData: (data) ->
# Handle incoming data
# You can access the html node of this widget with `@node`
@accessor 'value', Dashing.AnimatedValue
@accessor 'FCurrentColor', Dashing.AnimatedValue
@accessor 'FCurrentState', Dashing.AnimatedValue
$(@node).fadeOut().css('background-color', @get('FCurrentColor')).fadeIn()
最後の行は背景色を変更する必要がありますか? しかし、それは機能していません。