Apicloud [记录]
监听
api.sendEvent({
name:'JTName',
extra: {
mark: vm.transmitParam.codeMark,
newUrl:vm.sendBackPicUrl,
}
});
api.addEventListener({
name: 'JTName'
}, function (ret, err) {
if(isNotEmptyFn(ret.value)){
fn
}
setTimeout(function () {
api.closeWin({name:"pictureDeal"});
},500)
});
aMapLBS定位
禁止返回
keyback 监听 执行fn(空)
apicloud自封装的ajax使用
api.ajax({
url: tools.getApi(null,'/fileUpDownController/upload'),
method: 'post',
data: {
files:{
"file":picUrl,
},
},
dataType:'json',
report:true,
}, function(ret, err) {
if (ret) {
pleaseWaitFn();
if(ret.progress==100&&ret.statusCode==200){
if (vm.transmitParam.mark=="cash"){userAddCodePicFn(ret.body.data);}
else if(vm.transmitParam.mark=="setcode"){
if(isNotEmptyFn(vm.transmitParam.s_transmitParam.prevPicResourceId)){
userModifyCodePicFn(ret.body.data);
}else {
userAddCodePicFn(ret.body.data);
}
}
}
} else {
tools.CommonMackFn('上传失败,请重新上传');
}
});
openWin
api.openWin({
name: 'win_login',
url: '../../login/win_login.html',
pageParam: {
transmitParam: {“param1”:param1,“param2”:param2}
},
animation: {
type: "movein",
subType: "from_bottom",
curve: "ease_out",
duration: 300
}
})
api.openWin({
name: vm.transmitParam.sendWin.sendWinName,
url:vm.transmitParam.sendWin.sendWinUrl,
reload:true,
})
apicloud es6 的支持,需要浏览器内核支持,和APICloud平台本身无关; es6 的支持情况,取决于手机浏览器内核版本;
Click事件优化
<div class="content" tapmode onclick="fnOpenWareWin('{{=value.id}}');">
tapmode 具有快速点击事件的功能,消除了JS中标准click事件的300毫秒延迟;
api.parseTapmode();
图片上传
http://docs.apicloud.com/Client-API/UI-Layout/UIMediaScanner
http://www.cnblogs.com/jiqing9006/p/6026757.htm