给el-popover添加属性
:ref="popover-${scope.$index}"
主要代码
<el-popover
placement="top"
width="200"
@after-leave="nameeditHide"
:ref="`popover-${scope.$index}`"
>
<el-input
v-model="nameeditValue"
:placeholder="scope.row.cname"
></el-input>
<div style="text-align: right; margin: 10px 0">
<el-button
size="mini"
@click="scope._self.$refs[`popover-${scope.$index}`].doClose()"
>取消</el-button
>
<el-button
type="primary"
size="mini"
@click="nameeditClick(scope)"
>修改</el-button
>
</div>
<el-button
slot="reference"
size="mini"
type="text"
icon="el-icon-edit"
>名称修改
</el-button>
</el-popover>
关闭事件调用
nameeditClick(scope) {
console.log(scope);
this.$refs[`popover-${scope.$index}`].doClose()
},