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-button
size="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>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33