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
        });
    }
});

本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5970207.html,如需转载请自行联系原作者
相关文章
|
5月前
|
小程序
小程序与uniapp如何进行传参
小程序与uniapp如何进行传参
90 0
|
5月前
|
存储 小程序
微信小程序怎样获取参数!!!
微信小程序怎样获取参数!!!
|
5月前
|
小程序 JavaScript 前端开发
微信小程序(十一)小程序bindtap传参
文章列表页跳文章详情页的时候,我发现了一个问题,bindtap绑定的事件不能直接写:bindtap=jumpToArticle(item.id); 这样写不行,会报错:
46 0
|
5月前
|
存储 小程序 JavaScript
微信小程序(十二)小程序页面跳转及传参
Bindtap传参的问题解决了,那么跳页的时候,也需要传递参数,毕竟,从文章列表页,跳到文章详情页,是需要文章id的。 小程序这部分到是提供了不少的方法,大概整理了一下。
139 0
|
7月前
|
人工智能 JSON 自然语言处理
微信小程序页面跳转如何传递对象参数
微信小程序页面跳转如何传递对象参数
186 0
|
9月前
|
JavaScript 小程序
微信小程序事件传参
微信小程序事件传参
118 0
|
10月前
|
移动开发 小程序 JavaScript
微信小程序学习实录7(H5嵌入小程序、获取微信收货地址、数组对象url传值、js获取url参数)
微信小程序学习实录7(H5嵌入小程序、获取微信收货地址、数组对象url传值、js获取url参数)
231 0
|
10月前
|
运维 API PHP
漏刻有时API接口实战开发系列(13):小鹅通云服务PHP-API二维数组传参解决方案
漏刻有时API接口实战开发系列(13):小鹅通云服务PHP-API二维数组传参解决方案
77 1
|
11月前
|
小程序
原生微信小程序跳转传参 : [非TabBar跳转传参] 和 [TabBar跳转传参]
原生微信小程序跳转传参 : [非TabBar跳转传参] 和 [TabBar跳转传参]
105 0
|
11月前
|
JavaScript 前端开发 应用服务中间件
Vue中axios调用网上接口用POST方式传参
Vue中axios调用网上接口用POST方式传参