<template>
  <el-form
    size="mini"
    :inline="true"
    :model="searchForm"
    class="vt-search-form"
  >
    <el-form-item v-for="item in searchForm.inputList" :key="item.id">
      <VtFormElement :element="item" />
    </el-form-item>
    <el-form-item>
      <VtFormElement
        v-for="btn in searchForm.btnList"
        :key="btn.id"
        :element="btn"
      />
    </el-form-item>
  </el-form>
</template>

<script>
import VtFormElement from './vt-form-element/index';

export default {
  components: { VtFormElement },
  provide: function() {
    return {
      getSearchForm: this.searchForm,
      getSearchFormInputList: this.searchForm.inputList
    };
  },
  props: {
    searchForm: {
      type: Object,
      default: () => {
        return {
          inputList: [],
          btnList: []
        };
      }
    }
  },
  methods: {
    reset() {
      this.searchForm.inputList.forEach((one) => {
        one.model = null;
      });
    }
  }
};
</script>

<style lang="scss" scoped></style>
