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()
    }
相关推荐
余防4 分钟前
CSRF跨站请求伪造
前端·安全·web安全·csrf
兮山与9 分钟前
前端2.0
前端
南风木兮丶16 分钟前
Vue 项目安装 @antfu/eslint-config 保姆级教程
前端·javascript·vue.js
万少29 分钟前
记 HarmonyOS 开发中的一个小事件 怒提华为工单
前端·harmonyos
未来之窗软件服务30 分钟前
万象EXCEL开发(六)excel单元格运算逻辑 ——东方仙盟金丹期
前端·excel·仙盟创梦ide·东方仙盟·万象excel
mldong33 分钟前
保姆级教程!手把手教你搭建FastAPI + Vue3前后端分离项目
vue.js·python·全栈
Mintopia37 分钟前
🚀 Cesium-Kit:10 秒为你的 Cesium 项目添加动态光效标记
前端·javascript·cesium
Mintopia39 分钟前
🌩️ 云边协同架构下的 WebAI 动态资源调度技术
前端·javascript·aigc
Olrookie41 分钟前
若依前后端分离版学习笔记(十六)——scoped、路由跳转
前端·笔记
qaqxiaolei41 分钟前
高效办公利器:前端实现表格导出excel格式 + 自定义水印的完整方案
前端·javascript