Blame view

frontend/front/src/components/datav/DisplayText.vue 796 Bytes
8ea9c133   陈威   初始化提交
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
<template>
  <div :style="{ textAlign: config.text.textAlign }">
    <span class="text" :style="getStyle()">{{ config.text.content }}</span>
  </div>
</template>
<script>
  export default {
    name: 'DisplayText',
    props: {
      config: {
        type: Object,
        default: null,
      },
    },
    data() {
      return {}
    },
    mounted() {},
    methods: {
      getStyle() {
        if (this.config.isDiyStyle && this.config.diyStyle) {
          return JSON.parse(this.config.diyStyle)
        } else {
          return {
            fontSize: this.config.text.fontSize,
            color: this.config.text.color,
            fontWeight: this.config.text.fontWeight,
          }
        }
      },
    },
  }
</script>
<style>
  .text {
    display: inline-block;
  }
</style>