参考文档:https://docs.apicloud.com/Client-API/api
1.openWin跳转页面及带参数
api.openWin({
name: 'index',
url: './index.html',
pageParam:{name:'abc'} // 携带的参数,新页面中可以通过 api.pageParam 获取
});
2.closeWin关闭当前页面
例:
<a class="aui-pull-left aui-btn aui-btn-outlined" onclick="api.closeWin()">
<span class="aui-iconfont aui-icon-left"></span>
</a>
3.openTabLayout设置顶部、底部导航
var param = {
name: 'nav-tab',
title:'nav-tab',
bgColor:'#fff',
slidBackEnabled: false,
hideNavigationBar: true, // 是否隐藏顶部导航
// navigationBar: {
// hideBackButton: true
// },
tabBar: {
animated: true,
scrollEnabled: false,
list: [
{
text: "首页",
iconPath: "widget://image/footer/shouyes1.png",
selectedIconPath: "widget://image/footer/shouye2.png"
}, {
text: "菜谱",
iconPath: "widget://image/footer/caipus1.png",
selectedIconPath: "widget://image/footer/caipu2.png"
}, {
text: "社区",
iconPath: "widget://image/footer/shequs2.png",
selectedIconPath: "widget://image/footer/shequ2.png"
},
{
text: "购物车",
iconPath: "widget://image/footer/spcarts1.png",
selectedIconPath: "widget://image/footer/spcart2.png"
},
{
text: "我的",
iconPath: "widget://image/footer/wds1.png",
selectedIconPath: "widget://image/footer/wd2.png"
}
],
frames: [
{
title: "首页",//tab切换时对应的标题
name: "index",
url: "widget://html/index.html",
//其他继承自openFrame的参数
}, {
title: "菜谱",
name: "tab_frm_2",
url: "widget://html/menu.html"
//其他继承自openFrame的参数
}, {
title: "社区",
name: "tab_frm_3",
url: "widget://html/community.html"
//其他继承自openFrame的参数
},
{
title: "购物车",
name: "tab_frm_3",
url: "widget://html/shopcart.html"
//其他继承自openFrame的参数
},
{
title: "我的",
name: "tab_frm_4",
url: "widget://html/my.html"
//其他继承自openFrame的参数
}
]
}
}
api.openTabLayout(param);
4.setTabBarAttr设置tabBar属性(实现底部导航点击切换)
api.setTabBarAttr({
index:0, // 设置选中标签栏指定项
})
5.设置、获取、删除localStorage数据
$api.setStorage(key,val) // 设置
$api.getStorage(key) // 获取
$api.rmStorage(key) // 删除
$api.clearStorage () // 删除全部
连接地址: https://docs.apicloud.com/Front-end-Framework/framework-dev-guide#38