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張浩楠
相關文章
相關標籤/搜索