111
jihongshun
8 天以前 0c741cdda7ef9935a20d3090dfea97e1ce8ae754
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<template>
  <div style="font-family: hooge;height: 100%">
    <table style="width: 100%;height: 100%;text-align: center;">
      <tr style="height: 100%">
        <td v-for="item in cptData.value.length" :key="item"
            :style="{width:1/cptData.value.length*100+'%',padding:option.attribute.padding+'px'}">
          <div style="border: 1px solid;width: 100%;height: 100%;"
               :style="{lineHeight:height-option.attribute.padding*2+'px',backgroundColor:option.attribute.bgColor,
               borderColor:option.attribute.borderColor,fontSize: option.attribute.fontSize+'px',color: option.attribute.color}">
            {{cptData.value.substr(item-1,1)}}
          </div>
        </td>
      </tr>
    </table>
  </div>
</template>
 
<script>
import {getDataJson, pollingRefresh} from "@/utils/refreshCptData";
 
export default {
  name: "cpt-rect-num",
  props: {
    option: Object,
    height:Number
  },
  data() {
    return {
      cptData: {value:'12345'},
      uuid: null
    }
  },
  created() {
    this.uuid = require('uuid').v1();
    this.refreshCptData();
  },
  methods: {
    refreshCptData() {
      pollingRefresh(this.uuid, this.option.cptDataForm, this.loadData)
    },
    loadData() {
      getDataJson(this.option.cptDataForm).then(res => {
        this.cptData = res;
      });
    },
  }
}
</script>
 
<style scoped>
 
</style>