table表格中使用el-popover 无效问题解决

复制代码
实例只针对单个的按钮管用在表格里每一列都有el-popover相当于是v-for遍历了 所以我们在触发按钮的时候并不是单个的触发某一个 

主要执行 代码

<el-popover placement="left" :ref="`popover-{scope.index}`"> 动态绑定了ref

关闭弹窗 执行deltaskList

javascript 复制代码
  <el-table-column align="center" label="操作" fixed="right" width="300px">
          <!-- v-buttonShow="5010403" -->
          <template slot-scope="scope">

            <el-popover placement="left" :ref="`popover-${scope.$index}`">
              <div style="border-bottom: 1px solid #ebeef5; margin-bottom: 10px; padding-bottom: 6px">设置账期</div>
              <div style="display: flex; flex-direction: column">
                仅记录账期,并不会影响出账流程~
                <el-select
                  v-model="setAccountVal"
                  clearable
                  filterable
                  placeholder="请选择结算方式"
                  style="width: 260px; margin-top: 15px"
                  size="small"
                >
                  <el-option
                    v-for="(item, index) in paymentTermsList"
                    :key="index"
                    :label="item.name"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </div>
              <div style="text-align: right; margin: 0px; margin-top: 15px">
                <el-button type="text" @click="deltaskList(scope.$index)">取消 </el-button>
                <el-button size="small" type="primary" @click="popConfirmSub(scope.$index)">确定 </el-button>
              </div>
              <el-button
                style="margin-left: 10px"
                slot="reference"
                type="text"
                v-if="mode == '0'"
                @click="setAccountBtn(scope.row)"
                >设置账期</el-button
              >
            </el-popover>
          </template>
        </el-table-column>




    // 设置账期
    setAccountBtn (row, index) {
      let findItem = this.paymentTermsList.find((item) => item.name === row.paymentTerms)
      this.setAccountVal = findItem.value
      this.setAccountBtnRow = row
    },

    // 确定
    async popConfirmSub (index) {
      if (this.setAccountVal === '') return this.$message.error('请选择账期')
      await newFranchiseeCustomerPaymentTermsEdit({
        orgOwner: this.setAccountBtnRow.orgOwner,
        paymentTerms: this.setAccountVal
      })
      this.$message.success('操作成功')
      this.deltaskList(index)
      this.querySubmit(1)
    },

    // 取消
    deltaskList (index) {
      this.$refs[`popover-${index}`].doClose()
    }
相关推荐
anyup_前端梦工厂2 小时前
了解几个 HTML 标签属性,实现优化页面加载性能
前端·html
前端御书房2 小时前
前端PDF转图片技术调研实战指南:从踩坑到高可用方案的深度解析
前端·javascript
2301_789169542 小时前
angular中使用animation.css实现翻转展示卡片正反两面效果
前端·css·angular.js
风口上的猪20153 小时前
thingboard告警信息格式美化
java·服务器·前端
程序员黄同学3 小时前
请谈谈 Vue 中的响应式原理,如何实现?
前端·javascript·vue.js
爱编程的小庄4 小时前
web网络安全:SQL 注入攻击
前端·sql·web安全
宁波阿成5 小时前
vue3里组件的v-model:value与v-model的区别
前端·javascript·vue.js
柯腾啊5 小时前
VSCode 中使用 Snippets 设置常用代码块
开发语言·前端·javascript·ide·vscode·编辑器·代码片段
Jay丶萧邦5 小时前
el-select:有关多选,options选项值不包含绑定值的回显问题
javascript·vue.js·elementui
weixin_535854225 小时前
oppo,汤臣倍健,康冠科技,高途教育25届春招内推
c语言·前端·嵌入式硬件·硬件工程·求职招聘