<script>
import { Input } from 'element-ui'

export default {
    name: 'WsInput',
    extends: Input,
    props: {
        size: {
            default: 'small'
        },
        clearable: {
            default: true
        },
    },
    created(){
        this.setDefaultMaxLength();
    },
    watch: {
        $attrs(newval, oldval){
            this.setDefaultMaxLength();
        }
    },
    methods: {
        // 设置默认长度限制
        setDefaultMaxLength(){
            if(this.$attrs.maxlength == undefined && this.type != 'textarea'){
                try {
                    this.$attrs.maxlength = 64;
                } catch (error) {
                    // console.log(error)
                }
            }
        }
    }
}
</script>

<style>

</style>
