apicloud setlocalstorage 覆盖能覆盖吗

apiCloud的UI结构,window跟frame是啥关系,是否一个app一次只能展示一个window,但可以有多个frame?
一个app就是一个widget;每个widget允许有多个window,同时只允许一个window位于屏幕上,所以你可以将window看成当前屏幕;每个window下可以有多个frame和frameGroup,frame和frameGroup依附在window上,frameGroup包含一个可以横拖的frame数组。
已有帐号?
无法登录?
社交帐号登录ApiCloud基础(个人笔记)
APP会默认加载或打一个W窗口
W窗口(1个Window可以加载1个Frame子窗口或多个FrameG子窗口组合)
FrameG子窗口组合
可以目录操作,文件操作,文件存储方式用于图片,文档的上传,下载,删除,管理。
2、db:本地SQLite数据库,用于离线数据的存储(没有网络时,直接读取数据库,减少流量)。
3、localStorage:HTML5的存储功能,用于一些变量的存储,传递。比如:用户登录状态(手机重启后,它保存了用户信息,可以不用再次登录了)。比如多个页面之间的变量传递。(手机中不能用cookle,session的方式传递变量,)。
设置:$api.setStorage('Name',要设置的内容,或变量名);
获取:$api.getStorage('Name');
alert(Name);
结果:要设置的内容,或变量名
4、preference:偏好娄据存储模块,apecloud封装了setPrefs,getPrefs,removePrefs方法。如:皮肤,字体大小等个性设置。
设置:api.setPrefs({
&key:'user',
&value:userName(要设置的内容,或变量名)
获取:api.getPrefs({
&key: 'user'
function(ret, err){
&if(ret.value){
&alert(ret.value)
&结果:userName(要设置的内容,或变量名)
删除:api.removePrefs({
&key:'user'
5、页面与页传参:openWin有个pageParam参数,用这个传参数就可以了。新窗口中通过api.pageParam获取参数
设置参数:var
pageParam = api.pageP //比如: {"name" : "tans-con"}
获取参数:var
wgtParam = api.wgtP &//比如: {"name": "API
6、云、端一体,
api.showProgress();//显示加载时度框
api.hideProgress();//隐藏加载时度框
与自建服务器网络通信:
api.ajax方法,
//在指定窗口中执行脚本
&api.execScript({
&name:'root',
&frameName:'frame2',//指定到frame2窗口中
&script: 'mupiao()'//要执行的函数
//将任意一个自定义事件广播出去,该事件可在任意页面通过addEventListener监听收到。
api.sendEvent({
& name: 'myEvent',
& extra: {key1:'value1',
key2:'value2'}
//html页面a:监听事件
api.addEventListener({
& name: 'myEvent'
function(ret){
& if(ret && ret.value){
& & & var value
alert(value.key1 + ' , ' + value.key2);
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。3441人阅读
在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,
values: {name: 'haha'},
files: {file: 'fs://a.gif'}
},function(ret,err){
if (ret) {
var urlJson = JSON.stringify(ret);
api.alert({msg: urlJson});
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轴上的平移距离
x: 1.2,//&span style=&font-family: Arial, Helvetica, sans-&&x轴上的放大倍率&/span&
rotation:{
degree:45,//旋转角度
}, function() {
api.alert({msg: '动画结束'});
bringFrameToFront:调整子窗口到前面
api.bringFrameToFront({
from:'page1',
to:'page2'
});call:拨打电话
api.call({
type: 'tel_prompt',
number: '10086'
});cancelDownload:取消文件下载
var url = '/2013/photo/1401/DAimG_4260TA24.rar';
api.cancelDownload ({
});closeFrame:关闭子窗口
api.closeFrame({
name: 'page2'
});closeFrameGroup:关闭窗口组
api.closeFrameGroup({
name: 'group1'
});download文件下载:
var url = '/2013/photo/1401/DAimG_4260TA24.rar';
api.download({
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);
var value = err.
});execScript在指定窗口中执行脚本:
api.execScript({
name: 'page1',
script: 'exec();'//执行的JS方法
});getLocation获取位置信息api.getLocation(
function(ret, err){
if(ret.status){
var lat = ret.//纬度
var lon = ret.//经度
var t = ret. //更新时间
var str = '经度:'+ lon +'&br&';
str += '纬度:'+ lat +'&br&';
str += '更新时间:'+ t +'&br&';
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- font-size: 14 line-height: 20&&图片源类型&/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- font-size: 14 line-height: 20&&编码格式&/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- font-size: 14 line-height: 20&&媒体类型&/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- font-size: 14 line-height: 20&&返回数据类型&/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- font-size: 14 line-height: 20&&是否可以编辑&/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- font-size: 14 line-height: 20&&图片质量&/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- font-size: 14 line-height: 20&&压缩后的图片宽度&/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- font-size: 14 line-height: 20&&压缩后的图片高度&/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- font-size: 14 line-height: 20&&是否保存到相册&/span&
}, function(ret, err){
if (ret) {
api.alert({msg:ret.data});
api.alert({msg:err.msg});
mail发送邮件:
var recip = '';
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- font-size: 14 line-height: 20&&收件人&/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- font-size: 14 line-height: 20&&邮件主题&/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- font-size: 14 line-height: 20&&邮件内容&/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- font-size: 14 line-height: 20&&附件地址&/span&
}, function(ret, err){
if(ret.status){
api.alert({
msg: '发送成功'
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- font-size: 14 line-height: 20&&目标应用的包名或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- font-size: 14 line-height: 20&&指定目标应用的响应数据类型&/span&
uri: ''//&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- font-size: 14 line-height: 20&&指定目标应用响应的uri&/span&
},function(ret,err){
var msg = JSON.stringify(ret);
api.alert({
title: 'openApp',
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- font-size: 14 line-height: 20&&窗口名字&/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- font-size: 14 line-height: 20&&请求地址&/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- font-size: 14 line-height: 20&&窗口区域&/span&
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- font-size: 14 line-height: 20&&页面参数&/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- font-size: 14 line-height: 20&&页面是否弹动&/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- font-size: 14 line-height: 20&&页面是否不透明&/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- font-size: 14 line-height: 20&&背景色&/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- font-size: 14 line-height: 20&&是否显示垂直滚动条&/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- font-size: 14 line-height: 20&&是否显示&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- font-size: 14 line-height: 20&&水平&/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- font-size: 14 line-height: 20&&默认显示的页面索引&/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- font-size: 14 line-height: 20&&子窗口数组&/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.
var index = ret.
});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- font-size: 14 line-height: 20&&拾取器类型&/span&
date: ' 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- font-size: 14 line-height: 20&&时间格式化字符串,格式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- font-size: 14 line-height: 20&&标题&/span&
},function(ret,err){
var year = ret.
var month = ret.
var day = ret.
var hour = ret.
var minute = ret.
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- font-size: 14 line-height: 20&&侧滑类型(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- font-size: 14 line-height: 20&&左侧滑时,侧滑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- font-size: 14 line-height: 20&&底部固定层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.
if (type == 'left') {
});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- font-size: 14 line-height: 20&&侧滑类型,left或right,不能为空&/span&
});openWidget打开Widget:
api.openWidget({
id: 'UZ;,
animation: {
type: 'flip',
subType: 'from_bottom',
duration: 500
}, function(ret, err){
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', font-size: 13 line-height: 18.195 white-space: pre- background-color: rgb(238, 238, 238);&&文件内容&/span&
api.alert({
msg: '错误码: '+err.code+'错误信息'+err.msg&span style=&color: rgb(42, 161, 152); font-family: Menlo, Monaco, Consolas, 'Courier New', font-size: 13 line-height: 18.195 white-space: pre- 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-&&msg:&/span&&span style=&color: rgb(42, 161, 152); font-family: Menlo, Monaco, Consolas, 'Courier New', font-size: 13 line-height: 18.195 white-space: pre- 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- font-size: 14 line-height: 20&&窗口名字,指定时调整窗口到此窗口后面,否则调整到最后面&/span&
});setFrameAttr设置子窗口属性:
api.setFrameAttr({
name: 'page2',
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- font-size: 14 line-height: 20&&子窗口索引&/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- font-size: 14 line-height: 20&&是否平滑滚动至目标窗口&/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- font-size: 14 line-height: 20&&刷新图片地址&/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- font-size: 14 line-height: 20&&下拉文字描述&/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- font-size: 14 line-height: 20&&松开时文字描述&/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- font-size: 14 line-height: 20&&是否显示更新时间&/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- font-size: 14 line-height: 20&&展示在悬浮框中的图片地址&/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- font-size: 14 line-height: 20&&自动消隐时长。在该时长内不发生触摸悬浮框行为,悬浮框自动消隐至半透状态&/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- font-size: 14 line-height: 20&&是否模态&/span&
});writeFile写入文件:
api.writeFile({
path: 'fs://a.txt',
data: 'writeFile测试内容'
}, function(ret, err){
var status = ret.
if(status){
api.alert({msg:'写入文件成功'});
api.alert({msg:err.msg});
});removeLaunchView移除启动图。若config.xml里面配置autoLaunch为false,则启动图不会自动消失,直到调用此方法移除。
api.removeLaunchView();
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:15583次
排名:千里之外
原创:25篇
(1)(1)(3)(2)(1)(2)(1)(2)(3)(3)(1)(1)(1)(7)(7)

我要回帖

更多关于 拨备覆盖率 的文章

 

随机推荐