1 父组件写法
data() {return {loading: true,yfeList: []}}
import yfTable from "@/views/yf/yfTable.vue";
components: {yfTabTable},
<yfTabTable :loading="loading":yfList="yfList":handleUpdate="handleUpdate"/>
2 子组件写法
<template><el-table v-loading="loading" :data="yfList" ><el-table-column label="操作" align="center" class-name="small-padding fixed-width"><template slot-scope="scope"><el-buttonsize="mini"type="text"icon="el-icon-edit"@click="handleUpdate(scope.row)">修改</el-button></template></el-table-column></el-table>
</template><script>
export default {props:{loading: true,yfList: {type: Array,default: []},handleUpdate: {type: Function,default: null}}
}
</script>