1.evaluateMultiPopoverScript//Execute JS script in multi-page floating window
Uexwindow.evaluatemultipopoverscript ({
Windowname: "Root",
PopName: "Content",
PageName: "Index",
JS: "Getgoodslist ()"
});
Note: Packaging is required
2.appcan.window.evaluatescript (Name,scriptcontent,type)//In the specified window script execution
Appcan.window.evaluateScript ({
Name: ' dh ',//window name to execute the script
Scriptcontent: ' Appcan.window.close (-1); '//script to execute
}); Note: You need to start testing from the home page
3. Update push
Appcan.ready (function () {
if (typeof (uexupdate)! = "undefined") {
Uexupdate.onwidgetpatchupdate = function (opid,datatype,data) {
var obj = json.parse (data);
alert (obj.status);
if (obj.status== "OK")
{
Alert ("The update has been completed, please reopen the app");
Uexwidgetone.exit (0);
}
}
}
})
4.Ajax
Appcan.request.ajax ({
Url:basrurl+ "",
DataType: "JSON",
Type: "GET",
data:{
},
Success:function (data) {
Console.log (data);
}, Error:function (data) {
Alert ("Server access Error");
}
});
----------------------------------------
var pHtml = $ (' #pHtml '). html ();
Appcan.request.ajax ({
Url:basrurl+ "",
DataType: "JSON",
Type: "GET",
data:{
},
Success:function (data) {
Console.log (data);
var p = "
for (var i in data) {
p + = Phtml.replace (/\[(\w*) \]/igm, Function (node, key) {
return {
' Name ':d ata[i].name,
' ID ':d ata[i].id
}[key]
})
};
$ ("#p"). HTML (P)
}, Error:function (data) {
Alert ("Server access Error");
}
});
5.appcan.window.open (Name,data,aniid,type,datatype,width,height,animduration,extrainfo)//Open a new window
Appcan.window.open ({
Name: "DH",
Data: ' dh.html ',
Aniid:2,
datatype:0,
type:0
});
6.appcan.window.close (aniid,animduration)//close Current window
<a class= "return" id= "Close" ></a>
<script>
$ (function () {
Appcan.button ("#close", "Ani-act", function () {
Appcan.window.close (-1);
});
})
</script>
7. Bottom Navigation
var Tabview_tab;
(function ($) {
Tabview_tab = Appcan.tab ({
Selector: $ ("#Tab"),
Hasicon:true,
Hasanim:false,
Haslabel:true,
Hasbadge:false,
index:0,
Data: [{
"Label": "Home",
"Icon": "Fa-home"
},
{
"Label": "Shopping Cart",
"Icon": "Fa-shopping-cart"
},
{
"Label": "My",
"Icon": "Fa-user"
}]
});
Tabview_tab.on ("click", Function (obj, index) {
Set the index of the Sub-page window to which the multi-page floating window jumps
Appcan.frame.selectMulti (' content ', index)
})
Console.log (parseint ($ (' #footer '). CSS (' height '). Split (' px ') [0]) + ' px ');
$ (' #content '). CSS (' height ', window.outerheight-parseint (' #Footer '). CSS (' height '). Split (' px ') [0]) + ' px ');
Appcan.ready (function () {
Appcan.frame.open ({
ID: "Content",
URL: [{
"Inpagename": "Index",
"Inurl": "Index.html",
}, {
"Inpagename": "New",
"Inurl": "New.html",
}, {
"Inpagename": "Yhzx",
"Inurl": "Yhzx.html",
}],
top:0,
left:0,
index:0,
Change:function (index,res) {
/* Callback with floating window push change, can control tab to synchronize change */
Tabview_tab.moveto (Res.multipopselectedindex);
}
})
Window.onorientationchange = Window.onresize = function () {
var h = $ (' #content '). Offset (). Height;
Appcan.window.setMultiPopoverFrame ("Content", 0,0,0,h)
}
})
})($);
8.appcan.locstorage.getval (key)//Get key to save the corresponding value in Localstorage
Gets the saved
Color Appcan. Locstorage. Getval (' color '); Returns the saved color value
9.appcan.locstorage.setval (Key,val)//key-value pair to set
Set a color to local storage
Appcan. Locstoragesetval (' color ',' red ');
Appcan Common Essays