layui 解决弹出层layer.open不在顶层问题

      发布在:前端技术      评论:0 条评论
<p><span style="box-sizing: border-box; outline: 0px; font-weight: 700; overflow-wrap: break-word; color: rgb(77, 77, 77); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-size: 16px; font-variant-ligatures: no-common-ligatures; background-color: rgb(255, 255, 255);">在使用layer.open时,常常要在弹窗中再进行弹窗;有时候会出现第二次弹窗不是在最顶层的情况,通过添加zIndex和parent可以解决这个问题</span></p><pre class="brush:js;toolbar:false">// 父级open<br/> layer.open({<br/> title: &quot; &quot;,<br/> content: $(&#39;#editForm&#39;).html(),<br/> type: 1,<br/> zIndex:999, //数值越大优先级越高<br/> maxmin: true,<br/> shadeClose : true,<br/> area: [&#39;840px&#39;, &#39;580px&#39;],<br/> success: function(layero, index) {<br/><br/> // 子open<br/> //子需要添加 parent.<br/> parent.layer.open({ <br/>title: &quot; &quot;,<br/>content: $(&#39;#editForm&#39;).html(),<br/>type: 1,<br/>zIndex:10000, //子的值需要大于父级<br/>maxmin: true,<br/>shadeClose : true,<br/>area: [&#39;840px&#39;, &#39;580px&#39;],<br/>success: function(layero, index) {}<br/><br/>}<br/><br/><br/>来源:https://blog.csdn.net/weixin_43401042/article/details/115211927</pre>
相关文章
热门推荐