<style scoped>
</style>
<template>
    <div :class="nxInputClass">
        <Input v-model="currVal"
            @on-blur="blur"
            :placeholder="placeholder"
            :style="style"
            :rows="config.rows"
            type="textarea"
            clearable></Input>
        <br />
        <span class="error">{{fieldError}}</span>
    </div>
</template>
<script>
import Item from '../mixins/item';

export default {
    name: 'XInput',
    data() {
        return {
            currVal: undefined
        }
    },
    mixins: [Item],
    props: {
        config: {
            type: Object
        }
    },
    computed: {
        style() {
            return {
                'font-size': '12px'
            }
        },

        nxInputClass() {
            return {
                'ivu-form-item-error': this.fieldError
            };
        }
    },
    mounted() {
        console.log(this.config)
    },
    methods: {
        /*表单数据改变*/
        formValueChange(value) {
            if (value) {
                this.currVal = value[this.prop];
            }
        },

        /*获取数据*/
        getValue() {
            return this.currVal;
        },

        /*失去焦点是去掉必填显示*/
        blur() {
            if (this.currVal) {
                this.form.formError[this.prop] = null;
            }
        }
    }
};

</script>
