APICloud开发小技巧(二)

一、apicloud中 json、字符串之间的互转html

$api.jsonToStr(ret);
$api.strToJson(ret)

 二、页面的来回跳转json

例如已经打开了一个页面,跳转走,改变数据在跳转回来,这个时候数据是默认不变化的打开的是历史,想要清除历史后端

api.openWin({
            name : 'addAddress',
            url : '../main/addAddress.html',
            bounces : false,
            animation : {
                type : "push",
                duration : 300
            },
            reload: true,
            pageParam : {
                cartIds : cartIds
            }

        });

frame 和 window 打开的时候都加上:api

reload: true,
三、开发中常常遇到后端传来的数据是代码片断这时候就要用到转义了
{{@detail.content}}

 四、根据点击的元素查找父元素dom

function chooseItem(obj){
        var ele = $api.closest(obj, '.list_gui');
        var selectList = $api.domAll(ele, '.tapmLi');
        for(var i = 0; i < selectList.length; i++){
            $api.removeCls(selectList[i], 'active');
        }
        $api.addCls(obj, 'active');
    }

 五、打开framepost

apicloud能够直接打开特定frame。可是frame组是不行的。有的时候须要打开特定的frame组里面的一个frameui

api.setFrameGroupIndex({
        name: 'group',
        ndex: 0
});

 

 
by张浩楠
相关文章
相关标签/搜索