<template>
  <div>
    <hr />
    
    <div class="panel-row">
      <vpd-icon name="target" />
      <div class="panel-label">数据</div>
      <div class="panel-value" >
          <Input v-model="data" @on-change="dataChange(data)"/>
      </div>
    </div>
    <div class="panel-row">
      <vpd-icon name="target" />
      <div class="panel-label">单位</div>
      <div class="panel-value">
        <Input v-model="activeElement.option.unit" />
      </div>
    </div>
    
    <div class="panel-row">
      <vpd-icon name="target" />
      <div class="panel-label">环颜色</div>
      <div class="panel-value">
          <Input v-model="colors" />
      </div>
    </div>
    <div class="panel-row">
      <vpd-icon name="target" />
      <div class="panel-label">显示数值</div>
      <div class="panel-value">
        <Input v-model="activeElement.option.showValue" />
      </div>
    </div>
  </div>
  
</template>

<script>
export default {
  name: "DataVCasulebarStyle",
  props: ["activeElement"],
  data() {
    return {
      data:JSON.stringify(this.activeElement.option.data),
      colors:JSON.stringify(this.activeElement.option.colors)
    };
  },
  methods: {
    dataChange(newCode) {
      this.activeElement.option.data = JSON.parse(newCode);
      this.$parent.$vpd.commit("updateWidgets", this.activeElement);
    }
  },
  created () {
      // console.log(this.data,typeof(this.data),8888)
      // console.log(this.colors,typeof(this.colors),8888)
  }
};
</script>
