APICloud 多层FrameGroup嵌套引起遮盖

这里会用到一个特别重要的属性设置:

hidden: true

具体该如何让它发挥作用呢:

问题描述:

假设有FrameGroupA(包含Frame A1、A2),其中A1嵌套了FrameGroupB(包含Frame B1、B2)。此时B1、B2覆盖了A2。

解决方法:

1、在FrameGroupA中的api.openFrameGroup()方法的回调事件中对ret.index进行判断(假设A1的index为0)

function(ret, err) {
    if (ret.index != 0) {
        api.setFrameGroupAttr({
            name: 'FrameGroupB',
            hidden: true
        });
    }else {
        api.setFrameGroupAttr({
            name: 'FrameGroupB',
            hidden: false
        });
    }
); 

2、同时还需要注意,api.openFrameGroup()中有个preload属性,默认的值是1,即会加载当前页之后的第一个frame!,所以在前面的回调事件的基础上需给该回调事件对应的api.openFrameGroup()方法中的preload属性值设为0即可。

preload: 0
author:Lik
Endeavoring to powerless, struggling to move yourself.
原文地址:https://www.cnblogs.com/likwin/p/11101968.html