apiCloud中openFrameGroup傳參


apiCloud中openFrameGroup傳參

1.無效的

api.openFrameGroup({ // 打開 frame 組
    name: 'group',
    scrollEnabled: false,
    rect: {
        x: 0, 
        y: 0, 
        w: api.winWidth, 
        h: api.winHeight-$api.dom('footer').offsetHeight
    },
    pageParam:{
        'footer_height':$api.dom('footer').offsetHeight
    },
    index: 0,
    frames: frames
}, function (ret, err) {

});

在新頁面怎么獲取都得不到數據。

2.正確的,將參數放入frames中

var eFooterLis = $api.domAll('#footer .aui-bar-tab-item'),
    frames = []; // 選擇所有匹配的DOM元素
for (var i = 0,len = eFooterLis.length; i < len; i++) {
        // 判斷是否登錄
        var username = $api.getStorage('customer_id');
        var url = './html/frame'+i+'.html';
        if (i==4 && !username) {
            url = './html/userLogin.html';
        }
        frames.push( { 
            name: 'frame'+i, 
            url: url,
            bgColor : 'rgba(0,0,0,.2)',
            bounces:true,
            pageParam:{
                'footer_height':$api.dom('footer').offsetHeight
            },
        } )
}

api.openFrameGroup({ // 打開 frame 組
    name: 'group',
    scrollEnabled: false,
    rect: {
        x: 0,
        y: 0,
        w: api.winWidth,
        h: api.winHeight-$api.dom('footer').offsetHeight
    },
    index: 0,
    frames: frames
}, function (ret, err) {

});

新頁面獲取參數

var footer_height = api.pageParam.footer_height;
// 獲取菜單
api.ajax({
    url: BASE_SH_REQUEST_URL+'/?g=Api&m=Home&a=getRootCategory',
    method: 'get',
    data: {}
}, function(json, err) {
    if (json.status == '1') {
        var interText = doT.template($("#root_category_tmpl").text());
        $("#root_category").html(interText(json.info));
        var swiper_menu = new Swiper('#scroller.swiper-container', {
            slidesPerView: 4,
            paginationClickable: true,
            spaceBetween: 5
        });


        var header = $api.byId('main');
        $api.fixStatusBar(header);
        var pos = $api.offset(header);

        api.setStatusBarStyle({ // 設置頭部顏色
            style: 'dark'
        });

        api.openFrame({
            name: 'frame0Con',
            url: 'frame0Con.html',
            rect:{
                x: 0,
                y: pos.h,
                w: api.winWidth,
                h: api.winHeight - pos.h - footer_height,
            },
            bounces: true,
            opaque: true,
            vScrollBarEnabled: false,
            reload: true,
            pageParam:{
            }
        });

    } else {
        var toast = new auiToast();
        toast.fail({
            title: json.msg,
            duration: 2000
        });
    }
});


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM