<template>
    <el-form-item :label="label" :rules="requireRule(required, label)" :prop="prop">
        <el-table :data="data">
            <slot name="default"></slot>
        </el-table>
    </el-form-item>
</template>

<script>
import mixin from './mixin'

/**
 * 列表组件
 */
export default {
    name: 'TableInfo',
    mixins: [mixin],
    data(){
        return {
            data: []
        }
    },
    created(){
        this.$watch(() => this.$parent.model[this.prop], value => this.data = value, {immediate: true}) 
    },
    watch:{
        data(value){
            this.$parent.model[this.prop] = value
        }
    }
}
</script>

<style>

</style>