form-item.vue 748 Bytes
<template>
  <div class="form-item">
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'FormItem',
  props: {
    model: {
      type: String
    }
  },
  data() {
    return {
      items: []
    };
  },
  methods: {
    validate() {
      let result = true;

      this.items.forEach(i => {
        if (!i.validate()) {
          result = false;
        }
      });

      return result;
    },
    getItem() {
      this.items = this.$children.filter(i => i.$options.name === 'CUpload' || i.$options.name === 'CInput' || i.$options.name === 'CDatePick');
    }
  },
  mounted() {
    this.getItem();
  }
};
</script>

<style lang="scss" scoped>
.form-item {
  border-bottom: 2px solid #eee;
  padding: 30px 0;
}
</style>