我们想在table中给btn加弹框但是 el-popover点击按钮没有任何反应
思考:通过插槽去添加这个组件el-popover的id是否绑定了一个值
解决思路:给每个el-popover都加上单独的id
效果 :
代码 给每个组件都绑定ref
- <template slot-scope="scope">
- <div>
- <el-popover
- placement="left"
- v-else-if="scope.row.cmiBusiApproveInfo"
- width="400"
- :ref="`popover-${scope.$index}`">
- <p>审批意见p>
- <el-input
- type="textarea"
- placeholder="请输入内容"
- :rows="6"
- v-model="scope.row.approve"
- show-word-limit
- >
- el-input>
- <div style="text-align: center; margin: 10px">
- <el-button size="small" @click="deltaskList(scope.$index)">取消
- el-button>
- <el-button size="small" type="danger" @click="confirm(scope.row,'reject',scope.$index)">驳回
- el-button>
- <el-button size="small" type="primary" @click="confirm(scope.row,'agree',scope.$index)">确定
- el-button>
- div>
-
- <el-button slot="reference" @click="auditClick(scope.row,scope.$index)" size="mini" >审核el-button>
- el-popover>
-
-
- div>
- template>
通过他的id去控制关闭
- deltaskList(index){
- this.$refs[`popover-${index}`].doClose()
- },