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()
    }
相关推荐
叁两44 分钟前
用opencode打造全自动公众号写作流水线,AI 代笔太香了!
前端·人工智能·agent
golang学习记1 小时前
GitLens 十大神技:彻底改变你在 VS Code 中的 Git 工作流
前端·后端·visual studio code
SuperEugene1 小时前
后台权限与菜单渲染:基于路由和后端返回的几种实现方式
前端·javascript·vue.js
兆子龙1 小时前
WebSocket 入门:是什么、有什么用、脚本能帮你做什么
前端·架构
是一碗螺丝粉1 小时前
LangChain 链(Chains)完全指南:从线性流程到智能路由
前端·langchain·aigc
月弦笙音1 小时前
【浏览器】这几点必须懂
前端
青青家的小灰灰1 小时前
迈向全栈新时代:SSR/SSG 原理、Next.js 架构与 React Server Components (RSC) 实战
前端·javascript·react.js
SuperEugene1 小时前
弹窗与抽屉组件封装:如何做一个全局可控的 Dialog 服务
前端·javascript·vue.js
UrbanJazzerati1 小时前
事件传播机制详解(附直观比喻和代码示例)
前端
青青家的小灰灰1 小时前
透视 React 内核:Diff 算法、合成事件与并发特性的深度解析
前端·javascript·react.js