index.vue 825 Bytes
<script>
export default {
  name: 'SchemaTable',
  props: {
    value: {
      type: Array,
      default() {
        return [];
      },
    },
    schema: {
      required: true,
      type: Object,
      default() {
        return {};
      },
    },
    size: String,
  },
  data() {
    return {
      model: this.value,
    };
  },
  watch: {
    value(val = []) {
      this.model = val;
    },
    model: {
      handler(val) {
        this.$emit('input', val);
      },
      deep: true,
    },
  },
  render(h) {
    const schema = this.schema || {};
    const _props = schema.props || {};
    const _on = schema.on || this.$listeners || {};
    return h('eagle-table', { props: { value: this.model, size: this.size, columns: schema.items, ..._props }, on: _on, scopedSlots: this.$scopedSlots });
  },
};
</script>