Elemenu中el-table中使用el-popover選中關(guān)閉無效解決辦法(最新推薦)
Elemenu中el-table中使用el-popover選中關(guān)閉無效解決辦法
主要是技術(shù)太菜,沒找到原因,一點(diǎn)點(diǎn)才找到這個辦法解決
因?yàn)樵趀l-table-column里,因?yàn)槭嵌嘈?使用trigger="manual" 時(shí),用v-model="visible"來控制時(shí),控件找不到這個值,才換成trigger="click"
先找到彈出關(guān)閉事件,再找元素的屬性
右鍵>審核元素,找到他的單擊事件,里面就有關(guān)閉的屬性


使用ref定位,js中根據(jù)ref修改是否顯示showPopper = false;
頁面大概代碼
<el-table-column>
<template slot-scope="scope">
<el-popover :ref="col.prop+'_'+scope.$index" trigger="click" >
<span slot="reference" @click="ev_gytj_clk(scope.row,scope.$index)">{{ scope.row[col.prop] }}</span>
</el-popover>
</template>
</el-table-column>js代碼
ev_gytj_clkitem(row,index,item){
row.gytj=item
//Popper選中關(guān)閉
this.$refs['gytj_' + index][0].showPopper = false
},補(bǔ)充:
解決 el-table使用 el-popover 點(diǎn)擊沒反應(yīng) bug
項(xiàng)目場景:

原因分析:
在el-table使用el-popover時(shí)不能簡單的按照官網(wǎng)給的實(shí)例操作 實(shí)例只針對單個的按鈕管用在表格里每一列都有el-popover相當(dāng)于是v-for遍歷了 所以我們在觸發(fā)按鈕的時(shí)候并不是單個的觸發(fā)某一個
解決方案:
方法一:
<template slot-scope="scope">
<el-popover
placement="top"
:ref="`popover-${scope.$index}`">
<p>確定刪除?</p>
<div style="text-align: right; margin: 0">
<el-button style="padding: 2px;" size="mini" type="text" ??????? @click="scope._self.$refs[`popover-${scope.$index}`].doClose()">取消
</el-button>
<el-button style="padding: 2px;" type="primary" size="mini" @click="deltaskList(scope)">確定
</el-button>
</div>
<el-button slot="reference" type="text" size="small">刪除</el-button>
</el-popover>
</template>
//方法
deltaskList(e){
e._self.$refs[`popover-${e.$index}`].doClose();
},方法二:
<template slot-scope="scope">
<el-popover
placement="top"
:ref="`popover-${scope.$index}`">
<p>確定刪除?</p>
<div style="text-align: right; margin: 0">
<el-button style="padding: 2px;" size="mini" type="text" ??????? ??????? ??????? @click="deltaskList(scope.$index)">取消
</el-button>
<el-button style="padding: 2px;" type="primary" size="mini">確定
</el-button>
</div>
<el-button slot="reference" type="text" size="small">刪除</el-button>
</el-popover>
</template>
//方法
deltaskList(index){
this.$refs[`popover-${index}`].doClose()
},方法三:
<template slot-scope="scope">
<el-popover
placement="top"
v-model="item.row.visible">
<p>確定刪除?</p>
<div style="text-align: right; margin: 0">
<el-button style="padding: 2px;" size="mini" type="text" ??????? ??????? ??????? @click="deltaskList()">取消
</el-button>
<el-button style="padding: 2px;" type="primary" size="mini" ??????? @click="deltaskList()">確定
</el-button>
</div>
<el-button slot="reference" type="text" size="small">刪除</el-button>
</el-popover>
</template>
//方法
deltaskList(){
this.$refs.closepopover.click();
},到此這篇關(guān)于Elemenu中el-table中使用el-popover選中關(guān)閉無效解決辦法的文章就介紹到這了,更多相關(guān)el-table使用el-popover選中關(guān)閉無效內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue 使用自定義指令實(shí)現(xiàn)表單校驗(yàn)的方法
今天小編就為大家分享一篇vue 使用自定義指令實(shí)現(xiàn)表單校驗(yàn)的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-08-08
vue數(shù)據(jù)傳遞--我有特殊的實(shí)現(xiàn)技巧
這篇文章主要介紹了vue數(shù)據(jù)傳遞一些特殊梳理技巧,需要的朋友可以參考下2018-03-03
Vue項(xiàng)目中使用better-scroll實(shí)現(xiàn)菜單映射功能方法
這篇文章主要介紹了Vue項(xiàng)目中使用better-scroll實(shí)現(xiàn)菜單映射功能,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09
Vue tagsview實(shí)現(xiàn)多頁簽導(dǎo)航功能流程詳解
基本上后臺管理系統(tǒng)都需要有多頁簽的功能,但是因?yàn)橐恍┠_手架項(xiàng)目基本都把這個功能給集成好了,導(dǎo)致在學(xué)習(xí)或者修改的時(shí)候不知道該如何下手。今天這篇文章就來聊一聊,vue-element-admin項(xiàng)目是如何實(shí)現(xiàn)多頁簽功能的2022-09-09
Vue.js每天必學(xué)之指令系統(tǒng)與自定義指令
Vue.js每天必學(xué)之指令系統(tǒng)與自定義指令,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-09-09

