table表格中使用el-popover 無(wú)效問(wèn)題解決方法
table表格中使用el-popover 無(wú)效問(wèn)題解決方法
實(shí)例只針對(duì)單個(gè)的按鈕管用在表格里每一列都有el-popover相當(dāng)于是v-for遍歷了 所以我們?cè)谟|發(fā)按鈕的時(shí)候并不是單個(gè)的觸發(fā)某一個(gè)
主要執(zhí)行 代碼
<el-popover placement="left" :ref="`popover-${scope.$index}`"> 動(dòng)態(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"> 僅記錄賬期,并不會(huì)影響出賬流程~ <el-select v-model="setAccountVal" clearable filterable placeholder="請(qǐng)選擇結(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('請(qǐng)選擇賬期') 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無(wú)法彈出的問(wèn)題解決
1、不能再el-popover上?使?v-if進(jìn)?顯?隱藏,應(yīng)該?v-show
2、在每?個(gè)el-popover上都增加?個(gè)ref確定每個(gè)el-popover都是唯?的,
:ref="`node-popover-${scope.row.id}`"
3、需要使?slot="reference"定義由哪個(gè)元素觸發(fā)事件。
除此之外,還有一種特殊情況就是在table使用el-popover也可能會(huì)無(wú)法彈出,原因是在table中如果有兩行的key是相同的,那么table就不會(huì)對(duì)這一行再進(jìn)行一次渲染,如果第一行沒(méi)有使用到el-popover組件,那么與它key相同的所有行都不會(huì)再進(jìn)行渲染。
所以,再table中使用el-popover時(shí),一定要保證每一行的key都是唯一的。
到此這篇關(guān)于table表格中使用el-popover 無(wú)效問(wèn)題解決方法的文章就介紹到這了,更多相關(guān)table表格 el-popover 無(wú)效問(wèn)題內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue純前端使用exceljs導(dǎo)出excel文件方式
本文介紹了如何使用excel.js插件和Vue實(shí)現(xiàn)純前端Excel文件導(dǎo)出,并詳細(xì)步驟包括安裝插件、創(chuàng)建工作簿和工作表、定義列數(shù)據(jù)、設(shè)置樣式、行級(jí)操作、遍歷行和單元格、插入圖片和超鏈接2024-11-11使用Vue?Query實(shí)現(xiàn)高級(jí)數(shù)據(jù)獲取的示例詳解
構(gòu)建現(xiàn)代大規(guī)模應(yīng)用程序最具挑戰(zhàn)性的方面之一是數(shù)據(jù)獲取,這也是?Vue?Query?庫(kù)的用途所在,下面就跟隨小編一起學(xué)習(xí)一下如何利用Vue?Query實(shí)現(xiàn)高級(jí)數(shù)據(jù)獲取吧2023-08-08vue如何利用axios調(diào)用后臺(tái)api接口
這篇文章主要介紹了vue如何利用axios調(diào)用后臺(tái)api接口問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-07-07vue內(nèi)置組件transition簡(jiǎn)單原理圖文詳解(小結(jié))
這篇文章主要介紹了vue內(nèi)置組件transition簡(jiǎn)單原理圖文詳解(小結(jié)),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-07-07vue,angular,avalon這三種MVVM框架優(yōu)缺點(diǎn)
本文給大家具體分析了下vue,angular,avalon這三種MVVM框架優(yōu)缺點(diǎn),十分的細(xì)致全面,有需要的小伙伴可以參考下2016-04-04詳解vue的數(shù)據(jù)劫持以及操作數(shù)組的坑
這篇文章主要介紹了vue的數(shù)據(jù)劫持以及操作數(shù)組的坑,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04Django與Vue語(yǔ)法的沖突問(wèn)題完美解決方法
這篇文章主要介紹了Django與Vue語(yǔ)法的沖突問(wèn)題完美解決方法,本文給大家分享了兩種解決方法,需要的朋友參考下吧2017-12-12