el-tab下显示el-popover多个异常

el-tab下的el-table中,el-table-column的fixed="right",el-popover容易出现三个同时显示的异常bug,以下亲测有效

Tips: el-popover的ref绑定(:ref="`popover-${scope.row.id}`")

<el-popover placement="top" width="160" v-model="scope.row.visible"
                                :ref="`popover-${scope.row.id}`">
    <p>确定删除吗?</p>
    <div style="text-align: right; margin: 0">
         <el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
         <el-button type="primary" size="mini" @click="handleDel(scope.row)">确定</el-button>
    </div>
    <el-button icon="el-icon-delete" style="margin-left: 5px;" slot="reference"
                                    size="medium" type="text" @click="toDel(scope.row)">删除</el-button>
</el-popover>

 Tips:主要是document.getElementById(this.$refs[key][0].$refs.popper.id).style.display = 'none'这句代码,具体需要自己打印一下你的this.$refs[key]有多少个,自己尝试去控制,我是两个tab,第一个tab是留2,第二个tab是留3其他都display:none

toDel(row) {
            var that = this
            row.visible = true
            const key = 'popover-' + row.id
            this.$nextTick(() => {
                document.getElementById(this.$refs[key][0].$refs.popper.id).style.display = 'none'
                document.getElementById(this.$refs[key][1].$refs.popper.id).style.display = 'none'
                if (that.activeName == 1) {
                    document.getElementById(this.$refs[key][3].$refs.popper.id).style.display = 'none'
                } else if (that.activeName == 2) {
                    document.getElementById(this.$refs[key][2].$refs.popper.id).style.display = 'none'
                }
            })
        },

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值