compiled: function()

in app/scripts/components.js [11:27]


  compiled: function () {
    var vm = this;
    var $el = $(this.$el);
    $el.find('input').val(this.color);
    $el.colorpicker().on('changeColor', function () {
      // Avoid colorpicker will format the color string and cause vm updated
      // twice when editing the hex value
      var colorStr = $el.find('input').val();
      var isColorValid = echarts.color.parse(colorStr);
      if (isColorValid) {
        vm.$set('color', colorStr);
      }
    });
    vm.$watch('color', function(newV) {
      $el.colorpicker('setValue', newV);
    });
  },