table表格中使用el-popover 無效問題解決方法
table表格中使用el-popover 無效問題解決方法
實例只針對單個的按鈕管用在表格里每一列都有el-popover相當(dāng)于是v-for遍歷了 所以我們在觸發(fā)按鈕的時候并不是單個的觸發(fā)某一個

主要執(zhí)行 代碼
<el-popover placement="left" :ref="`popover-${scope.$index}`"> 動態(tài)綁定了ref
關(guān)閉彈窗 執(zhí)行deltaskList
<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">設(shè)置賬期</div>
<div style="display: flex; flex-direction: column">
僅記錄賬期,并不會影響出賬流程~
<el-select
v-model="setAccountVal"
clearable
filterable
placeholder="請選擇結(jié)算方式"
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)"
>設(shè)置賬期</el-button
>
</el-popover>
</template>
</el-table-column>
// 設(shè)置賬期
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()
}el-popover無法彈出的問題解決
1、不能再el-popover上?使?v-if進(jìn)?顯?隱藏,應(yīng)該?v-show
2、在每?個el-popover上都增加?個ref確定每個el-popover都是唯?的,
:ref="`node-popover-${scope.row.id}`"
3、需要使?slot="reference"定義由哪個元素觸發(fā)事件。
除此之外,還有一種特殊情況就是在table使用el-popover也可能會無法彈出,原因是在table中如果有兩行的key是相同的,那么table就不會對這一行再進(jìn)行一次渲染,如果第一行沒有使用到el-popover組件,那么與它key相同的所有行都不會再進(jìn)行渲染。
所以,再table中使用el-popover時,一定要保證每一行的key都是唯一的。
到此這篇關(guān)于table表格中使用el-popover 無效問題解決方法的文章就介紹到這了,更多相關(guān)table表格 el-popover 無效問題內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue2之jessibuca視頻插件使用教程詳細(xì)講解
Jessibuca進(jìn)行直播流播放,為用戶帶來便捷、高效的視頻觀看體驗,下面這篇文章主要給大家介紹了關(guān)于vue2之jessibuca視頻插件使用的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下2024-09-09
詳解vue-cli 快速搭建單頁應(yīng)用之遇到的問題及解決辦法
這篇文章主要介紹了詳解vue-cli 快速搭建單頁應(yīng)用之遇到的問題及解決辦法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-03-03
Vue實現(xiàn)父子組件之間的數(shù)據(jù)傳遞
在前端開發(fā)中,Vue.js 是一個非常流行的框架,因其易學(xué)易用而受到許多開發(fā)者的青睞,其中,組件是 Vue 的核心概念之一,組件之間的數(shù)據(jù)傳遞是開發(fā)中的常見需求,本文將探討如何在 Vue 中實現(xiàn)父子組件之間的數(shù)據(jù)傳遞,需要的朋友可以參考下2024-11-11
Element中el-select下拉框?qū)崿F(xiàn)選中圖標(biāo)并回顯圖標(biāo)
本文主要介紹了Element中el-select下拉框?qū)崿F(xiàn)選中圖標(biāo)并回顯圖標(biāo),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-12-12

