首页 > 其他分享 >iview 多弹框,显示z-index 不对,被遮挡的解决方案 goTop函数 modal Drawer 抽屉

iview 多弹框,显示z-index 不对,被遮挡的解决方案 goTop函数 modal Drawer 抽屉

时间:2023-03-20 14:05:23浏览次数:48  
标签:index const goTop Drawer targetZIndex drawer modal

iview 多弹框,显示z-index 不对,被遮挡的解决方案 goTop函数 modal

原因

弹多个modal框的时候,会被遮挡,导致后显示的框在下面

解决原理

获取当前弹框的z-index,然后设置新弹框是之前弹框的值加200即可

函数源码

export const goTop = (targetDom = '.ivu-modal-wrap', returnDom = '.drawer-1') => {
const targetD = document.querySelector('.customHeaderModal').querySelector(targetDom)
const returnD = document.querySelectorAll(returnDom)
const targetZIndex = targetD.style[`z-index`]
console.log(targetZIndex)
returnD.forEach((dom, index) => {
const inner = dom.querySelector('.ivu-drawer-wrap')
const innerMask = dom.querySelector('.ivu-drawer-mask')
inner.style[`z-index`] = Number(targetZIndex) + 200 + index
innerMask.style[`z-index`] = Number(targetZIndex) + 200 + index
})
}

执行方法

在点击的click事件中执行

this.$nextTick(() => {
this.drawerShow = true
goTop()
})

弹框的抽屉加class

<!--抽屉-->
<Drawer title="aaa"
v-model="aaa"
class="drawer-1" // 增加这个class

---------------------------------------------
生活的意义并不是与他人争高下,而在于享受努力实现目标的过程,结果是对自己行动的嘉奖。
↑面的话,越看越不痛快,应该这么说:

生活的意义就是你自己知道你要做什么,明确目标。没有目标,后面都是瞎扯!

新博客 ​​​https://www.VuejsDev.com​​ 用于梳理知识点



标签:index,const,goTop,Drawer,targetZIndex,drawer,modal
From: https://blog.51cto.com/u_15770151/6132715

相关文章

  • Windows.edb占用空间太大,如何禁用或删除Windows 搜索索引( Windows Search Index)
    .原文:《https://zhuanlan.zhihu.com/p/507590692》最近电脑上C盘的空间不够了,发现主要是C盘腾讯的微信和QQ占用比较大的空间,这个将来想办法设置数据到其它目录,另发现系统有......
  • IndexRequest与updateRequest
     问题:使用org.elasticsearch.client.RestHighLevelClient#bulk,BulkRequest添加的是IndexRequest,发现无法更新索引。原因:IndexRequest设定添加文档,UpdateRequest设定......
  • 15、INDEX索引(下)
    管理索引创建索引CREATE[UNIQUE|FULLTEXT|SPATIAL]INDEXindex_nameONtable_name(column1[ASC|DESC],column2[ASC|DESC],...);ALTERTABLEtable_nameADD[UNIQUE......
  • SQL Server索引概要(2)-非聚集索引(Non-Clustered Index)
    介绍在上一篇SQLServer聚集索引概述 中,我们探讨了SQLServer中索引和聚集索引的要求。在我们继续之前,让我们快速总结一下SQLServer聚集索引:它根据聚集索引键对......
  • pandas.DataFrame.sample和pandas.DataFrame.reset_index函数
    pandas.DataFrame.sample-从DataFrame或Series对象中随机取样DataFrame.sample(n=None, frac=None, replace=False, weights=None, random_state=None, axis=None, ......
  • 【MySQL】substring_index 函数详解
    【MySQL】substring_index函数详解命令格式stringsubstring_index(string<str>,string<separator>,int<count>)命令说明截取字符串str第count个分隔符之前的字......
  • 题解 ABC293G【Triple Index】
    莫队板子。类似于小B的询问,在移动指针过程中,维护每个数出现次数\(cnt_i\),同时维护\(\sum\binom{cnt_i}{3}\)即可。取序列分块块长\(B=\frac{n}{\sqrt{m}}\),有最优......
  • 第128篇:浏览器存储(cookie、webStorage、 IndexedDB)
    好家伙,本篇为《JS高级程序设计》第二五章“浏览器存储”学习笔记 我们先来讲个故事一个“薅羊毛”的故事(qq.com)概括一下,就是有个人通过网络平台非法购买了大量“c......
  • index
    Repetition牙慧我说啊,人的过去和想法就跟垃圾一样,源源不断的,好的坏的团在一起,有时费尽心机想给别人展示好的,就像从破旧杂乱的厨房里颤颤巍巍地端出一道拿手菜一样。—......
  • 【813】How to write to CSV in R without index?
    Ref:HowtowritetoCSVinRwithoutindex?Usingrow.namestoindicateifindicearekeptornot. write.csv(data,"data.csv",row.names=FALSE)......