APICloud介绍
来源:互联网 发布:2016网络暴力事例 编辑:程序博客网 时间:2024/06/13 23:10
在APICloud创建了应用之后,应用的包结构如下图所示:
其中“config.xml”和 “index.html” 必须包含,其它均为可选。“config.xml”是配置文件,“index.html”是启动页面,“icon”为图标文件目录,“launch”为启动图片目录
actionSheet底部弹出框:
api.actionSheet({ title: '底部弹出框测试', cancelTitle: '这里是取消按钮', destructiveTitle: '红色警告按钮', buttons: ['1','2','3']},function(ret,err){ api.alert({ msg: '你刚点击了'+ret.buttonIndex });});confirm对话框:
api.confirm({ title: 'testtitle', msg: 'testmsg', buttons:[ '确定', '取消']},function(ret,err){ if(ret.buttonIndex == 1){ api.alert({msg: '点击了确定'}); }});
alert对话框:
api.alert({ title: 'testtitle', msg: 'testmsg', buttons:[ '确定']},function(ret,err){ if(ret.buttonIndex == 1){ api.alert({msg: '点击了确定'}); }});prompt带输入框的对话框
api.prompt({ buttons:['确定', '取消']},function(ret,err){ if(ret.buttonIndex == 1){ api.alert({msg:ret.text}); }});
ajax:异步请求
api.ajax({ url: 'http://192.168.1.101:3101/upLoad', method: 'post', cache: false, timeout: 30, dataType: 'json', returnAll:false, data:{ values: {name: 'haha'}, files: {file: 'fs://a.gif'} }},function(ret,err){ if (ret) { var urlJson = JSON.stringify(ret); api.alert({msg: urlJson}); }else { api.alert({ msg:('错误码:'+err.code+';错误信息:'+err.msg+'网络状态码:'+err.statusCode) }); };});
animation动画:
api.animation ({ name: 'page1',//子窗口名称 delay: 1000, duration: 3000, curve: 'easeIn',//动画曲线类型 repeatCount: 2, autoreverse: true,//一次动画结束后是否自动反转动画 alpha: 0.6, translation:{//平移参数 x: 0,//x轴上的平移距离 y: 100, z: 0 }, scale:{ x: 1.2,//<span style="font-family: Arial, Helvetica, sans-serif;">x轴上的放大倍率</span> y: 1, z: 1 }, rotation:{ degree:45,//旋转角度 x: 0, y: 0, z: 1 }}, function() { api.alert({msg: '动画结束'});});
bringFrameToFront:调整子窗口到前面
api.bringFrameToFront({ from:'page1', to:'page2'});call:拨打电话
api.call({ type: 'tel_prompt', number: '10086'});cancelDownload:取消文件下载
var url = 'http://file05.daimg.com/2013/photo/1401/DAimG_2014011335974260TA24.rar';api.cancelDownload ({ url: url});closeFrame:关闭子窗口
api.closeFrame({ name: 'page2'});closeFrameGroup:关闭窗口组
api.closeFrameGroup({ name: 'group1'});download文件下载:
var url = 'http://file05.daimg.com/2013/photo/1401/DAimG_2014011335974260TA24.rar';api.download({ url: url, savePath: 'fs://test.rar',//下载后的保存路径,如果为空会自动创建保存路径 report: true,//是否上报 cache: true,//是否缓存 allowResume:true//是否支持断点续传},function(ret,err){ if (ret) { var value = ('文件大小:'+ret.fileSize+';下载进度:'+ret.percent+';下载状态'+ret.state+'存储路径: '+ret.savePath); } else{ var value = err.msg; };});execScript在指定窗口中执行脚本:
api.execScript({ name: 'page1', script: 'exec();'//执行的JS方法});getLocation获取位置信息
api.getLocation( function(ret, err){ if(ret.status){ var lat = ret.latitude;//纬度 var lon = ret.longitude;//经度 var t = ret.timestamp; //更新时间 var str = '经度:'+ lon +'<br>'; str += '纬度:'+ lat +'<br>'; str += '更新时间:'+ t +'<br>'; } else{ api.alert({msg:err.msg}); } });getPicture获取图片:
api.getPicture({ sourceType: 'library',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">图片源类型</span> encodingType: 'png',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">编码格式</span> mediaValue: 'pic',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">媒体类型</span> destinationType: 'url',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">返回数据类型</span> allowEdit: true,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否可以编辑</span> quality: 50,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">图片质量</span> targetWidth:100,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">压缩后的图片宽度</span> targetHeight:100,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">压缩后的图片高度</span> saveToPhotoAlbum: false//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否保存到相册</span>}, function(ret, err){ if (ret) { api.alert({msg:ret.data}); } else{ api.alert({msg:err.msg}); };});
mail发送邮件:
var recip = 'test@163.com';var sub = '邮件测试';var body = '这是一封测试用的邮件';var attach = 'widget://a.txt';api.mail({ recipients: [recip],//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">收件人</span> subject: sub,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">邮件主题</span> body: body,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">邮件内容</span> attachments: [attach]//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">附件地址</span>}, function(ret, err){ if(ret.status){ api.alert({ msg: '发送成功' }); } else{ api.alert({ msg: '发送失败' }); }});openApp打开手机上的其他应用:
api.openApp({//此方法只使用与Android应用 androidPkg: 'android.intent.action.VIEW',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">目标应用的包名或action(Android平台使用)</span> mimeType: 'text/html',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">指定目标应用的响应数据类型</span> uri: 'http://www.baidu.com'//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">指定目标应用响应的uri</span>},function(ret,err){ var msg = JSON.stringify(ret); api.alert({ title: 'openApp', msg: msg, buttons: ['确定'] });});openFrame打开子窗口:
api.openFrame({ name: 'page2',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">窗口名字</span> url: './page2.html',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">请求地址</span> rect:{//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">窗口区域</span> x:0, y:0, w:320, h:480 }, pageParam: {name: 'test'},//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">页面参数</span> bounces: true,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">页面是否弹动</span> opaque: false,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">页面是否不透明</span> bgColor: 'rgba(0,0,0,0)',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">背景色</span> vScrollBarEnabled:true,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否显示垂直滚动条</span> hScrollBarEnabled:true//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否显示<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">水平</span>滚动条</span>});openFrameGroup打开窗口组:
api.openFrameGroup ({ name: 'group1', background:'#fff', scrollEnabled:false, rect:{x:0, y:0, w:320, h:240}, index:0,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">默认显示的页面索引</span> frames://<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">子窗口数组</span> [{ name: 'frame1', url: 'frame1.html', pageParam:{}, bounces:true, opaque:true, bgColor: '#fff', vScrollBarEnabled:true, hScrollBarEnabled:false },{ name: 'frame2', url: 'frame2.html', pageParam:{}, bounces:true, opaque:true, bgColor: '#fff', vScrollBarEnabled:true, hScrollBarEnabled:false }]}, function(ret, err){ var name = ret.name; var index = ret.index;});openPicker打开时间选择器:
api.openPicker({ type: 'date_time',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">拾取器类型</span> date: '2014-05-01 12:30',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">时间格式化字符串,格式yyyy-MM-dd HH:mm</span> title:'选择时间'//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">标题</span>},function(ret,err){ var year = ret.year; var month = ret.month; var day = ret.day; var hour = ret.hour; var minute = ret.minute; if (type == 'date') { var value = year+'年'+month+'月'+day+'日'; } else if (type == 'time') { var value = hour+'时'+minute+'分'; } else if (type == 'date_time') { var value = year+'年'+month+'月'+day+'日'+hour+'时'+minute+'分'; }});openSlidLayout打开侧滑式布局:
api.openSlidLayout ({ type: 'all',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">侧滑类型(left:左侧滑、right:右侧滑、all:左右侧滑)</span> leftEdge:80,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">左侧滑时,侧滑window停留时露出的宽度</span> rightEdge:60, fixedPane: {//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">底部固定层window</span> name: 'frame1', url: 'frame1.html', bgColor: '#fff', bounces:true, opaque:true, vScrollBarEnabled:true, hScrollBarEnabled:false }, slidPane: { name: 'frame1', url: 'frame1.html', bgColor: '#fff', bounces:true, opaque:true, vScrollBarEnabled:true, hScrollBarEnabled:false }}, function(ret){ var type = ret.type; if (type == 'left') { } else { }});openSlidPane侧滑:
api.openSlidPane ({ type: 'left'//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">侧滑类型,left或right,不能为空</span>});openWidget打开Widget:
api.openWidget({ id: 'UZ00000001', animation: { type: 'flip', subType: 'from_bottom', duration: 500 }}, function(ret, err){ if(ret){ } else{ api.alert({msg:err.msg}); }});openWin打开窗口,如果窗口已存在,则会把窗口显示到最前面:
api.openWin({ name: 'page1', url: './page1.html', pageParam: {name: 'test'}, bounces: true, opaque: false, bgColor: 'rgba(0,0,0,0)', vScrollBarEnabled:true, hScrollBarEnabled:true, animation: { type: 'flip', subType: 'from_bottom', duration: 500 }});
parseTapmode解析元素tapmode属性,优化点击事件处理
api.parseTapmode();
readFile读取文本文件:
api.readFile({ path:'fs://a.txt'}, function(ret, err){ if(ret.status){ api.alert({msg:ret.data});//data<span style="color: rgb(147, 161, 161); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; line-height: 18.571428298950195px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">文件内容</span> } else{ api.alert({ msg: '错误码: '+err.code+'错误信息'+err.msg<span style="color: rgb(42, 161, 152); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; line-height: 18.571428298950195px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">//</span><span style="font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif;">msg:</span><span style="color: rgb(42, 161, 152); font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; line-height: 18.571428298950195px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">错误描述</span> }); }});refreshHeaderLoadDone通知顶部刷新数据加载完毕
api.refreshHeaderLoadDone();removeEventListener删除事件:
api.removeEventListener({ name: 'online'});
sendFrameToBack调整子窗口到后面:
api.sendFrameToBack ({//调整page1到page2的后面即将page2放在最page1上 from: 'page1', to: 'page2'//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">窗口名字,指定时调整窗口到此窗口后面,否则调整到最后面</span>});setFrameAttr设置子窗口属性:
api.setFrameAttr({ name: 'page2', rect:{ x:0, y:0, w:320, h:480 }, bounces: true, opaque: true, bgColor: '#fff', vScrollBarEnabled:true, hScrollBarEnabled:true});
setFrameGroupAttr设置窗口组属性:
api.setFrameGroupAttr({ name: 'group1', hidden:true});
setFrameGroupIndex设置窗口组当前可见子窗口:
api.setFrameGroupIndex ({ name: 'group1', index:2,//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">子窗口索引</span> scroll:true//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否平滑滚动至目标窗口</span>});setFullScreen设置是否全屏:
api.setFullScreen({fullScreen:true});setRefreshHeaderInfo显示顶部刷新:
api.setRefreshHeaderInfo({ visible: true, loadingImg: 'widget://image/refresh.png',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">刷新图片地址</span> bgColor: '#ccc', textColor: '#fff', textDown: '下拉刷新...',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">下拉文字描述</span> textUp: '松开刷新...',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">松开时文字描述</span> showTime: true//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否显示更新时间</span>}, function(ret, err){});
showFloatBox展示一个悬浮框,浮动在屏幕上,点击时关闭当前widget:
api.showFloatBox ({ iconPath: 'widget://image/icon.png',//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">展示在悬浮框中的图片地址</span> duration: 3000//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">自动消隐时长。在该时长内不发生触摸悬浮框行为,悬浮框自动消隐至半透状态</span>});showProgress显示进度提示框:
api.showProgress({ style: 'default', animationType: 'fade', title: '努力加载中...', text: '先喝杯茶...', modal: false//<span style="color: rgb(128, 128, 128); font-family: ff-tisa-web-pro-1, ff-tisa-web-pro-2, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', 'Hiragino Sans GB W3', 'WenQuanYi Micro Hei', sans-serif; font-size: 14px; line-height: 20px;">是否模态</span>});writeFile写入文件:
api.writeFile({ path: 'fs://a.txt', data: 'writeFile测试内容'}, function(ret, err){ var status = ret.status; if(status){ api.alert({msg:'写入文件成功'}); } else{ api.alert({msg:err.msg}); }});removeLaunchView移除启动图。若config.xml里面配置autoLaunch为false,则启动图不会自动消失,直到调用此方法移除。
api.removeLaunchView();
1 0
- APICloud介绍
- APICloud
- APICloud
- 移动开发利器——APICloud开发平台介绍
- ApiCloud基础
- apiCloud小结
- apicloud验证车牌号
- apicloud学习笔记
- apicloud图片上传
- 关于apicloud开发注意事项
- 如何评价 APICloud ?
- apicloud 心得 绝对路径
- [APICloud]初始篇
- [APICloud]云端数据库操作
- APICloud css样式大全
- ApiCloud (1)
- APiCloud学习笔记
- APicloud商品详情界面
- 有关td使用colspan属性后导致td不能充满整个tr的问题解决方法
- tripleo 脚本 devtest.sh 简介
- MySQL帐号远程的设置方法(转)将主机名中的LocalHost改成%即支持远程
- PreparedStatement execute执行插入成功却返回false
- mysql 支持的web程序乱码
- APICloud介绍
- 【转】C#实现UDP分包组包
- 解决error 25541 failed to open xml fileC:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine
- 第15周-“三天打鱼 两天晒网”
- Tornado + supervisor + nginx 环境部署与初体验
- 关于#include "stdafx.h
- 关于iOS8上本地通知接收不到的问题
- 【Android】Android模拟器无法上网问题
- 频率带宽解释