
父组件将id传给子组件:
弹窗点击事件:
父组件:
<template slot-scope="scope">
<el-button type="text" size="small" @click="upimages(scope.row.id)">上报信息</el-button>
<el-button type="text" size="small" @click="faultResult(scope.row.id)">故障处理</el-button>
<el-button type="text" size="small" @click="deleteRow(scope.row.id)">删除</el-button>
</template>
引用弹窗的地方:
<image-modal :visible.sync="dialogVisible" :id="id"/>
定义一个数字类型的id
data() {
return {
id: null,
}
将id赋值:
upimages(id) {
this.id = id
this.$set(this.$data, 'dialogVisible', true)
},
子组件定义一个id接收:
props: {
id: {
type: Number
}
},

被折叠的 条评论
为什么被折叠?



