<template>
  <div class='adminbank-login-form'>
    <form class='form'>
      <div v-for='(val, key) in C_inputList'>
        <component v-bind='val'></component>
      </div>
    </form>
  </div>
</template>

<script>
  import './style.less';
  
  export default {
    name: 'LoginForm',
    data () {
      return {
      }
    },
    props: ['formData'],
    components: {
    },
    computed: {
      C_inputList () {
        return this.formData.list.map(val => {
          if (!val.component || val.component === 'input') {
            val.is = this.$COMP.InputHUI;
            val.size = val.size || 'full';
            val.enter = val.enter || this._submit;
            val.input = val.input || this._input;
          }
          if (val.component === 'button') {
            val.is = this.$COMP.ButtonHUI;
            val.type = val.type || 'primary';
            val._style = val._style || {
              width: '100%',
              margin: '20px 0 0 0'
            };
            val.onClick = val.onClick || this._submit;
          }
          return val;
        })
      }
    },
    created () {
    },
    methods: {
      _input (e) {
        console.log(e)
      },
      _submit () {
        console.log('submit')
      },
    }
  }
</script>