apicloud header footerTabble切换 openframeGroup

博客介绍了切换显示tab的相关处理,指出只需在openframegroup中添加激活状态,在切换页面中不能添加active,否则点击第三个tab时,第二个tab会闪现激活状态图标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://blog.youkuaiyun.com/tianshi51/article/details/53306467#commentBox

var tab = $api.byId('footer');
var eFooterLis = $api.domAll(tab, '.aui-bar-tab-item'),
    frames = []; // 选择所有匹配的DOM元素
var urlArr = ['menu_hot','menu_two','menu_three','menu_four','menu_hot'];
for (var i = 0, len = eFooterLis.length; i < len; i++) {
    var url = urlArr[i] + '.html';
    frames.push({
        name: 'frame' + i,
        url: url,
        bounces: false,
        vScrollBarEnabled: false,
        hScrollBarEnabled: false,
    })
}
api.openFrameGroup({
    name: 'group',
    scrollEnabled: true,
    index: 0,
    frames: frames,
    rect: {
        x: 0,
        y: headerPos.h,
        w: 'auto',
        h: mainPos.h - footerPos.h
    }
}, function(ret, err) {
    var $tab = $api.byId('footer');

    var footerAct = $api.dom(footer, '.aui-bar-tab-item.active');
    $api.removeCls(footerAct, 'active');

    var index = ret.index;
    if (index == 0) {
        api.refreshHeaderLoadDone();
        var $obj = $api.byId('0');
        $api.text($api.byId('header'), '热门');
        $api.addCls($obj, 'active');
    }
    if (index == 1) {
        var $obj = $api.byId('1');
        $api.text($api.byId('header'), '爆款');
        $api.addCls($obj, 'active');
    }
    if (index == 2) {
        var $obj = $api.byId('2');
        $api.text($api.byId('header'), '必下款');
        $api.addCls($obj, 'active');
    }
    if (index == 3) {
        var $obj = $api.byId('3');
        $api.text($api.byId('header'), '下载必备');
        $api.addCls($obj, 'active');
    }
})

切换显示的tab

goMenu: function(item) {

    // item.active = true
    this.activeId = item.id
    this.text = item.text

    var index = item.id;
    api.setFrameGroupIndex({
        name: 'group',
        index: index,
        scroll: true
    });
}

 

只需要在openframegroup中添加激活状态,在切换页面中不能添加active 否则底部状态会 点击第三个tab时  第二个tab也会闪现一下激活的状态图标。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值