zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!--
 * @Author: your name
 * @Date: 2019-10-21 15:40:58
 * @LastEditTime: 2019-10-28 19:06:23
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \cts-web\src\views\area\components\AreaText.vue
 -->
<template>
  <el-form-item
    class="textareaLabel"
    :label="config.filedDescription"
    :prop="config.name"
    :rules="rules"
  >
    <el-input
      v-model="svalue"
      :rows="3"
      type="textarea"
      @input="change($event)"
      :readonly="!config.writeAble"
      :placeholder="placeholderContent"
      resize="none"
      :maxlength="length"
    ></el-input>
  </el-form-item>
</template>
 
<script>
export default {
  // props: ['config', 'value', 'placeholderContent'],
  props: {
    config: {
      type: Object,
      default: () => ({})
    },
    value: {
      type: String,
      default: ''
    },
    placeholderContent: {
      type: String,
      default: ''
    },
    length: {
      type: [Number, String]
    }
  },
  data: function() {
    return {
      rules: {
        required: this.config.required,
        message: '请输入' + this.config.filedDescription,
        trigger: 'blur'
      },
      svalue: this.value,
      writeAble: false
    }
  },
  watch: {
    'config.required': function(newVal) {
      this.rules.required = newVal
    }
  },
  methods: {
    change(val) {
      this.$emit('input', val)
    }
  }
}
</script>
 
<style lang="stylus" scoped>
.textareaLabel {
  >>>.el-form-item__label {
    margin-bottom: 60px;
  }
 
  .el-form-item__content {
    .el-textarea {
      >>> .el-textarea__inner {
        color: #000;
      }
 
      // 文本框为readonly时,只读
      >>> .el-textarea__inner[readonly='readonly'] {
        color: #666;
        background-color: #fafafa;
      }
    }
  }
}
</style>