<!--
|
* @Author: your name
|
* @Date: 2019-10-21 15:40:58
|
* @LastEditTime: 2019-10-28 18:59:01
|
* @LastEditors: Please set LastEditors
|
* @Description: In User Settings Edit
|
* @FilePath: \cts-web\src\views\area\components\AreaInput.vue
|
-->
|
<template>
|
<el-form-item :label="config.filedDescription" :prop="config.name" :rules="rules">
|
<el-input
|
class="text-area-row"
|
v-model="svalue"
|
:rows="inputRows"
|
:type="inputType"
|
:placeholder="placeholder"
|
@input="change($event)"
|
:readonly="!config.writeAble"
|
resize="none"
|
></el-input>
|
</el-form-item>
|
</template>
|
|
<script>
|
import { money } from '@/views/area/mixins'
|
export default {
|
props: ['config', 'value', 'inputType', 'inputRows', 'placeholder'],
|
mixins: [money],
|
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
|
},
|
'value': function(newVal) {
|
this.svalue = newVal
|
}
|
},
|
methods: {
|
change(val) {
|
this.$emit('input', val)
|
}
|
}
|
}
|
</script>
|
<!-- 文本框为readonly时,只读 -->
|
<style lang="postcss" scoped>
|
.text-area-row {
|
& >>> .el-textarea__inner {
|
color: #000;
|
}
|
.el-textarea__inner[readonly='readonly'] {
|
color: #666;
|
background-color: #fafafa;
|
}
|
}
|
</style>
|